public class Schema extends Object
You can create Schema objects and put them in Options when creating or opening the database.
SystemCapability.Data#DATA_DISTRIBUTEDDATAMGR| 构造器 | 说明 |
|---|---|
Schema() |
A constructor used to create a
Schema instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
List<List<String>> |
getCompositeIndexes() |
Obtains the list of composite indexes that has been set for this
Schema instance. |
List<String> |
getIndexes() |
Obtains the list of fields to be indexed in this
Schema instance. |
FieldNode |
getRootFieldNode() |
Obtains the root
FieldNode of this Schema instance. |
SchemaMode |
getSchemaMode() |
Obtains the mode of this
Schema instance. |
String |
getVersion() |
Obtains the version number of this
Schema instance. |
boolean |
setCompositeIndexes(List<List<String>> compositeIndexes) |
Sets a list of composite indexes for this
Schema instance. |
boolean |
setIndexes(List<String> indexes) |
Sets the index list of this
Schema instance. |
void |
setSchemaMode(SchemaMode schemaMode) |
Sets the mode of this
Schema instance. |
public Schema()
Schema instance.
The initialized Schema instance contains an empty index list and a default root FieldNode.
public void setSchemaMode(SchemaMode schemaMode)
Schema instance.schemaMode - Indicates the mode to set for this Schema instance.public boolean setIndexes(List<String> indexes)
Schema instance.
The index list specifies which fields of the Schema instance are to be indexed.
Each index in the list is a string starting with $..
indexes - Indicates the index list to set.true if the index list is set successfully; returns false otherwise.public String getVersion()
Schema instance.Schema instance.public SchemaMode getSchemaMode()
Schema instance.Schema instance.public List<String> getIndexes()
Schema instance.public List<List<String>> getCompositeIndexes()
Schema instance.public boolean setCompositeIndexes(List<List<String>> compositeIndexes)
Schema instance.
A composite index contains multiple index fields of a Schema instance.
Each index field in a composite index must be unique. During a query using the
composite index, its index fields are used for matching in sequence.
The first index field of each composite index cannot be the same as any one of
the index fields set via #setIndexes(java.util.List or the first index field of
any other composite index.
compositeIndexes - Indicates the composite indexes to set. The value is a list of lists.
The inner list indicates a composite index, and the outer list indicates multiple composite indexes.true if the index list is set successfully; returns false otherwise.public FieldNode getRootFieldNode()
FieldNode of this Schema instance.
The initialized Schema instance contains a default root FieldNode.
By obtaining the root FieldNode and adding child nodes to it, you can define the Schema
instance.
The root FieldNode should contain at least one child node.
FieldNode of this Schema instance.