Skip to main content

Schema

Struct Schema 

Source
pub struct Schema {
    pub schema_version: u32,
    pub labels: HashMap<String, LabelMeta>,
    pub edge_types: HashMap<String, EdgeTypeMeta>,
    pub properties: HashMap<String, HashMap<String, PropertyMeta>>,
    pub indexes: Vec<IndexDefinition>,
    pub constraints: Vec<Constraint>,
    pub schemaless_registry: SchemalessEdgeTypeRegistry,
}

Fields§

§schema_version: u32§labels: HashMap<String, LabelMeta>§edge_types: HashMap<String, EdgeTypeMeta>§properties: HashMap<String, HashMap<String, PropertyMeta>>§indexes: Vec<IndexDefinition>§constraints: Vec<Constraint>§schemaless_registry: SchemalessEdgeTypeRegistry

Registry for schemaless edge types (dynamically assigned IDs)

Implementations§

Source§

impl Schema

Source

pub fn label_name_by_id(&self, label_id: u16) -> Option<&str>

Returns the label name for a given label ID.

Performs a linear scan over all labels. This is efficient because the number of labels in a schema is typically small.

Source

pub fn label_id_by_name(&self, label_name: &str) -> Option<u16>

Returns the label ID for a given label name.

Source

pub fn edge_type_name_by_id(&self, type_id: u32) -> Option<&str>

Returns the edge type name for a given type ID.

Performs a linear scan over all edge types. This is efficient because the number of edge types in a schema is typically small.

Source

pub fn edge_type_id_by_name(&self, type_name: &str) -> Option<u32>

Returns the edge type ID for a given type name.

Source

pub fn vector_index_for_property( &self, label: &str, property: &str, ) -> Option<&VectorIndexConfig>

Returns the vector index configuration for a given label and property.

Performs a linear scan over all indexes. This is efficient because the number of indexes in a schema is typically small.

Source

pub fn get_label_case_insensitive(&self, name: &str) -> Option<&LabelMeta>

Get label metadata with case-insensitive lookup.

This allows queries to match labels regardless of case, providing better user experience when label names vary in casing.

Source

pub fn label_id_by_name_case_insensitive(&self, label_name: &str) -> Option<u16>

Get label ID with case-insensitive lookup.

Source

pub fn get_edge_type_case_insensitive( &self, name: &str, ) -> Option<&EdgeTypeMeta>

Get edge type metadata with case-insensitive lookup.

This allows queries to match edge types regardless of case, providing better user experience when type names vary in casing.

Source

pub fn edge_type_id_by_name_case_insensitive( &self, type_name: &str, ) -> Option<u32>

Get edge type ID with case-insensitive lookup (schema-defined types only).

Source

pub fn edge_type_id_unified_case_insensitive( &self, type_name: &str, ) -> Option<u32>

Get edge type ID with case-insensitive lookup, checking both schema-defined and schemaless registries.

Source

pub fn get_or_assign_edge_type_id(&mut self, type_name: &str) -> u32

Returns the edge type ID for type_name, checking the schema first and falling back to the schemaless registry (assigning a new ID if needed).

Requires &mut self because it may assign a new schemaless ID. Use edge_type_id_by_name for read-only schema lookups.

Source

pub fn edge_type_name_by_id_unified(&self, type_id: u32) -> Option<String>

Returns the edge type name for type_id, checking both the schema and schemaless registries. Returns an owned String because the name may come from either registry.

Source

pub fn all_edge_type_ids(&self) -> Vec<u32>

Returns all edge type IDs, including both schema-defined and schemaless types. Used when MATCH queries don’t specify an edge type and need to scan all edges.

Trait Implementations§

Source§

impl Clone for Schema

Source§

fn clone(&self) -> Schema

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Schema

Source§

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

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

impl Default for Schema

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Schema

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 Serialize for Schema

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

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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