pub struct InMemorySchemaBuilder { /* private fields */ }Expand description
Builder for InMemorySchema.
All mutation goes through this builder so the target struct remains invariant-preserving: unique label / rel type / parameter names, deterministic iteration order (spec 0001 §17.14).
Implementations§
Source§impl InMemorySchemaBuilder
impl InMemorySchemaBuilder
Sourcepub fn add_label(self, name: SmolStr, properties: Vec<PropertyDecl>) -> Self
pub fn add_label(self, name: SmolStr, properties: Vec<PropertyDecl>) -> Self
Declare a label. The first insertion wins; subsequent
insertions with the same name are recorded and surfaced by
InMemorySchemaBuilder::build.
Sourcepub fn add_rel_type(self, rel: RelDecl) -> Self
pub fn add_rel_type(self, rel: RelDecl) -> Self
Declare a relationship type. The first insertion wins;
subsequent insertions are recorded and surfaced by
InMemorySchemaBuilder::build.
Sourcepub fn add_parameter(self, param: ParamDecl) -> Self
pub fn add_parameter(self, param: ParamDecl) -> Self
Declare a query parameter.
Sourcepub fn schema_name(self, name: Option<SmolStr>) -> Self
pub fn schema_name(self, name: Option<SmolStr>) -> Self
Set the schema name from a [meta] block.
Sourcepub fn description(self, desc: Option<String>) -> Self
pub fn description(self, desc: Option<String>) -> Self
Set the description from a [meta] block.
Sourcepub fn build(self) -> Result<InMemorySchema, BuilderError>
pub fn build(self) -> Result<InMemorySchema, BuilderError>
Finalise the builder.
Returns the first duplicate label name encountered (if any),
the first duplicate rel type name, or the built schema.
Reference validation (rel_type endpoints referring to declared
labels) lives in the TOML loader, not the builder — the
builder has no view of the original source ordering.