Skip to main content

ConstraintType

Enum ConstraintType 

Source
pub enum ConstraintType {
    Unique,
    Key,
    Exists,
    PropertyType,
    LabelExistence,
    NodeLabelExistence,
    SourceLabel,
    SourceLabelExistence,
    TargetLabel,
    TargetLabelExistence,
}
Expand description

The kind of a schema Constraint, persisted as Constraint::constraint_type.

Replaces the previous stringly-typed constraint_type: String. The serde representation is the exact tag written by earlier versions, so pre-enum databases load unchanged, and an unknown tag is a hard deserialization error instead of being silently ignored by a _ => {} catch-all.

Variants§

§

Unique

§

Key

§

Exists

§

PropertyType

§

LabelExistence

A node label-existence constraint derived from a graph type (ALTER CURRENT GRAPH TYPE).

§

NodeLabelExistence

The standalone REQUIRE alias:Label node label-existence form.

§

SourceLabel

A relationship source-label constraint derived from a graph type.

§

SourceLabelExistence

The standalone relationship source-label form.

§

TargetLabel

A relationship target-label constraint derived from a graph type.

§

TargetLabelExistence

The standalone relationship target-label form.

Implementations§

Source§

impl ConstraintType

Source

pub fn as_str(&self) -> &'static str

The canonical stored tag — identical to the serde representation and to the pre-enum Constraint::constraint_type string.

Source

pub fn is_index_backed(&self) -> bool

Whether this constraint kind is backed by a range index — the two kinds (unique/key) that share one physical backing index per schema.

Source

pub fn is_enforced_label_kind(&self) -> bool

Whether this kind is one of the six label/endpoint-label existence kinds that carry an enforced label (CIP-187): labelExistence, nodeLabelExistence, sourceLabel, sourceLabelExistence, targetLabel, targetLabelExistence. Single source of truth for the string check in the executor’s requires_enforced_label.

Source

pub fn enforced_label_site(&self) -> Option<EnforcedLabelSite>

Where an enforced-label kind checks its enforced label: on the constrained node, or on the start or end node of the constrained relationship. None for every kind that carries no enforced label. This is the typed form of the enforced-label entity split: the kind attaches to a relationship iff the site is not EnforcedLabelSite::Node.

Source

pub fn enforces_uniqueness(&self) -> bool

Whether this kind enforces uniqueness of the constrained properties: unique and key (a key constraint is uniqueness + existence). Today this is exactly the index-backed set, but the predicate is named for the semantic guarantee, not the physical backing.

Source

pub fn enforces_property_presence(&self) -> bool

Whether this kind requires the constrained properties to be present (non-null) on every matching entity: exists, and key (a key property must exist). The enforced-label kinds (ConstraintType::is_enforced_label_kind) enforce label presence, not property presence, so they are excluded.

Source§

impl ConstraintType

Source

pub fn unknown_kind_message(name: &str, reason: &str) -> String

The one spelling of the pinned unknown-kind reply (ConstraintValidationFailed: unknown constraint type "…"), shared by the catalog’s durable-row gate and the executor’s validator.

Trait Implementations§

Source§

impl Clone for ConstraintType

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ConstraintType

Source§

impl Debug for ConstraintType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ConstraintType

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ConstraintType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ConstraintType

Source§

impl FromStr for ConstraintType

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parse a stored tag. Unknown tags are rejected rather than silently defaulting.

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

impl Hash for ConstraintType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ConstraintType

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<&str> for ConstraintType

Source§

fn eq(&self, other: &&str) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<str> for ConstraintType

Source§

fn eq(&self, other: &str) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ConstraintType

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ConstraintType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.