pub struct GraphSchema { /* private fields */ }Expand description
A complete, optional graph schema.
Implementations§
Source§impl GraphSchema
impl GraphSchema
pub fn new() -> Self
pub fn add_node(&mut self, schema: NodeSchema) -> &mut Self
pub fn add_edge(&mut self, schema: EdgeSchema) -> &mut Self
pub fn add_vector(&mut self, schema: VectorSchema) -> &mut Self
pub fn node(&self, label: &str) -> Option<&NodeSchema>
pub fn edge(&self, edge_type: &str) -> Option<&EdgeSchema>
pub fn vector(&self, name: &str) -> Option<&VectorSchema>
Sourcepub fn node_schemas_sorted(&self) -> Vec<&NodeSchema>
pub fn node_schemas_sorted(&self) -> Vec<&NodeSchema>
Node schemas sorted by label (deterministic — for codegen).
Sourcepub fn edge_schemas_sorted(&self) -> Vec<&EdgeSchema>
pub fn edge_schemas_sorted(&self) -> Vec<&EdgeSchema>
Edge schemas sorted by edge type (deterministic — for codegen).
Sourcepub fn vector_schemas_sorted(&self) -> Vec<&VectorSchema>
pub fn vector_schemas_sorted(&self) -> Vec<&VectorSchema>
Vector schemas sorted by name (deterministic — for codegen).
Sourcepub fn validate_self(&self) -> Result<()>
pub fn validate_self(&self) -> Result<()>
Validate the schema’s own internal consistency: every edge’s from/to
label and every vector’s bound label must reference a declared node. Run
this once after building the schema (HelixQL’s compile-time check).
Sourcepub fn validate_node(&self, node: &Node) -> Result<()>
pub fn validate_node(&self, node: &Node) -> Result<()>
Validate a node against any declared schema for its labels. Labels with no schema pass through (schemaless coexistence).
Sourcepub fn validate_edge(
&self,
edge: &Edge,
from_labels: &[String],
to_labels: &[String],
) -> Result<()>
pub fn validate_edge( &self, edge: &Edge, from_labels: &[String], to_labels: &[String], ) -> Result<()>
Validate an edge given the labels of its endpoints. Undeclared edge types pass through. Pass the actual from/to node labels so direction + endpoint types are checked.
Sourcepub fn validate_vector_dims(
&self,
vector_type: &str,
query: &[f32],
) -> Result<&VectorSchema>
pub fn validate_vector_dims( &self, vector_type: &str, query: &[f32], ) -> Result<&VectorSchema>
Validate that a query vector matches a declared vector type’s dimension.
Trait Implementations§
Source§impl Clone for GraphSchema
impl Clone for GraphSchema
Source§fn clone(&self) -> GraphSchema
fn clone(&self) -> GraphSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphSchema
impl Debug for GraphSchema
Source§impl Default for GraphSchema
impl Default for GraphSchema
Source§fn default() -> GraphSchema
fn default() -> GraphSchema
Source§impl<'de> Deserialize<'de> for GraphSchema
impl<'de> Deserialize<'de> for GraphSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GraphSchema
impl RefUnwindSafe for GraphSchema
impl Send for GraphSchema
impl Sync for GraphSchema
impl Unpin for GraphSchema
impl UnsafeUnpin for GraphSchema
impl UnwindSafe for GraphSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request