pub enum PropertyConstraintKind {
Unique,
NotNull,
PropertyType(PropertyType),
NodeKey,
}Expand description
Kind of single-property constraint. Unique comes from
REQUIRE n.prop IS UNIQUE, NotNull from REQUIRE n.prop IS NOT NULL, and PropertyType(t) from REQUIRE n.prop IS :: <TYPE>.
PropertyType carries the target type so a single constraint-kind
enum covers all four flavours without blowing up into one variant
per type.
Variants§
Unique
NotNull
PropertyType(PropertyType)
NodeKey
REQUIRE (n.a, n.b) IS NODE KEY — composite uniqueness + NOT
NULL. The constraint holds across the tuple of values the
spec’s properties list names; each property must be present
and the tuple must be unique across every node carrying the
constrained label.
Implementations§
Source§impl PropertyConstraintKind
impl PropertyConstraintKind
Sourcepub fn as_string(&self) -> String
pub fn as_string(&self) -> String
Short, human-facing token used in SHOW CONSTRAINTS output.
For PropertyType the string carries the target type inside
parentheses so operators reading the output can see what the
constraint enforces at a glance. Stable — do not rename
without a migration, because the auto-name the storage layer
derives from this tag is part of the user-visible DROP surface.
Sourcepub fn name_tag(&self) -> String
pub fn name_tag(&self) -> String
Lowercase tag used when generating a default constraint name.
PropertyType(T) contributes type_<t> so every distinct type
gets its own auto-name and two type constraints on the same
(label, property) can coexist if they ever need to.
Sourcepub fn allows_multi_property(&self) -> bool
pub fn allows_multi_property(&self) -> bool
True iff the kind accepts more than one property in its spec.
Used by the storage layer to validate the properties list
length at create time — single-property kinds must not receive
a multi-element list.
Trait Implementations§
Source§impl Clone for PropertyConstraintKind
impl Clone for PropertyConstraintKind
Source§fn clone(&self) -> PropertyConstraintKind
fn clone(&self) -> PropertyConstraintKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more