MySQL Connector/C++ 9.1.0
MySQL connector library for C and C++ applications
Public Types | Public Member Functions | List of all members
CollectionValidation Class Reference

The CollectionValidation class defines collection schema and level of validation. More...

Public Types

enum  Level { OFF = 1 , STRICT = 2 }
 Collection validation level options. More...
 
enum  Option { SCHEMA = 1 , LEVEL = 2 , LAST }
 Collection validation options More...
 

Public Member Functions

 CollectionValidation (DbDoc doc)
 Constructor using a document. More...
 
template<typename... Rest>
 CollectionValidation (Option opt, Rest &&... rest)
 Construct CollectionValidation from list of Option and value pairs. More...
 
template<typename... Rest>
void set (Rest &&... options)
 Set list of Option and value pairs. More...
 

Detailed Description

The CollectionValidation class defines collection schema and level of validation.

Member Enumeration Documentation

◆ Level

enum Level

Collection validation level options.

Enumerator
OFF 

No validation will be done on the collection.

STRICT 

All collection documents have to comply to validation schema.

◆ Option

enum Option

Collection validation options

Enumerator
SCHEMA 

Collection validation schema, as defined by https://dev.mysql.com/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid

LEVEL 

Defines level of validation on the collection, see CollectionValidation::Level. In plain C code the value should be mysqlx_collection_validation_level_t.

Constructor & Destructor Documentation

◆ CollectionValidation() [1/2]

CollectionValidation ( DbDoc  doc)
inline

Constructor using a document.

Document example:

{
"level": "Strict",
"schema":
{
"id": "http://json-schema.org/geo",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "A geographical coordinate",
"type": "object",
"properties":
{
"latitude":
{
"type": "number"
},
"longitude":
{
"type": "number"
}
},
"required": ["latitude", "longitude"]
}
}
}

Document keys:

◆ CollectionValidation() [2/2]

CollectionValidation ( Option  opt,
Rest &&...  rest 
)
inline

Construct CollectionValidation from list of Option and value pairs.

See CollectionValidation::Option for possible options.

Member Function Documentation

◆ set()

void set ( Rest &&...  options)
inline

Set list of Option and value pairs.

See also
CollectionValidation::CollectionValidation

The documentation for this class was generated from the following file: