pub struct ClassSchema {
pub class_name: String,
pub fields: IndexMap<String, FieldType>,
pub clp: Option<ClassLevelPermissions>,
pub indexes: Option<ParseMap>,
pub field_options: Option<ParseMap>,
}Expand description
The shape of one class: what a transform needs to lower or raise a document.
Order-preserving, because _SCHEMA documents are compared in golden files and because the
order fields were added is the order upstream writes them.
Fields§
§class_name: String§fields: IndexMap<String, FieldType>§clp: Option<ClassLevelPermissions>_metadata.class_permissions, parsed.
None is not “public”. It is “the key is absent”, which reads back as defaultCLPS,
a fully public block including an ACL key that the present-but-partial case never
carries (MongoSchemaCollection.js:67-112). The distinction is preserved rather than
normalized, because normalizing either way rewrites a block parse-server reads.
indexes: Option<ParseMap>_metadata.indexes, round-tripped verbatim and never interpreted.
field_options: Option<ParseMap>_metadata.fields_options, round-tripped as sent. A schema body is decoded without
interpreting a __type envelope, so an offset instant, unpadded base64 and any key the
envelope does not declare all survive, which is what a parse-server node reading the same
row expects. 0.2.0 stores required and defaultValue for fleet safety and does not
enforce them.
Implementations§
Source§impl ClassSchema
impl ClassSchema
pub fn new(class_name: impl Into<String>) -> Self
pub fn with_clp(self, clp: ClassLevelPermissions) -> Self
Sourcepub fn relation_fields(&self) -> impl Iterator<Item = (&str, &str)>
pub fn relation_fields(&self) -> impl Iterator<Item = (&str, &str)>
Every Relation field, with its target class.
pub fn with_field(self, name: impl Into<String>, ty: FieldType) -> Self
pub fn field(&self, name: &str) -> Option<&FieldType>
Sourcepub fn is_pointer_field(&self, name: &str) -> bool
pub fn is_pointer_field(&self, name: &str) -> bool
Is this field stored under a _p_ prefix?
Note the deliberate narrowness: only a declared Pointer field is prefixed. A pointer
value written to a field the schema does not know about is not prefixed by
transformKey, because that function consults the schema and nothing else.
Trait Implementations§
Source§impl Clone for ClassSchema
impl Clone for ClassSchema
Source§fn clone(&self) -> ClassSchema
fn clone(&self) -> ClassSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more