pub struct Catalog { /* private fields */ }Expand description
The database’s schema dictionary - maps names to compact internal IDs.
You rarely interact with this directly. The query processor uses it to resolve names like “Person” and “name” to internal IDs.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn with_schema() -> Self
pub fn with_schema() -> Self
Creates a new catalog with schema constraints enabled.
This is now equivalent to new() since schema is always enabled.
Sourcepub fn get_or_create_label(&self, name: &str) -> LabelId
pub fn get_or_create_label(&self, name: &str) -> LabelId
Gets or creates a label ID for the given label name.
Sourcepub fn get_label_id(&self, name: &str) -> Option<LabelId>
pub fn get_label_id(&self, name: &str) -> Option<LabelId>
Gets the label ID for a label name, if it exists.
Sourcepub fn get_label_name(&self, id: LabelId) -> Option<Arc<str>>
pub fn get_label_name(&self, id: LabelId) -> Option<Arc<str>>
Gets the label name for a label ID, if it exists.
Sourcepub fn label_count(&self) -> usize
pub fn label_count(&self) -> usize
Returns the number of distinct labels.
Sourcepub fn all_labels(&self) -> Vec<Arc<str>>
pub fn all_labels(&self) -> Vec<Arc<str>>
Returns all label names.
Sourcepub fn get_or_create_property_key(&self, name: &str) -> PropertyKeyId
pub fn get_or_create_property_key(&self, name: &str) -> PropertyKeyId
Gets or creates a property key ID for the given property key name.
Sourcepub fn get_property_key_id(&self, name: &str) -> Option<PropertyKeyId>
pub fn get_property_key_id(&self, name: &str) -> Option<PropertyKeyId>
Gets the property key ID for a property key name, if it exists.
Sourcepub fn get_property_key_name(&self, id: PropertyKeyId) -> Option<Arc<str>>
pub fn get_property_key_name(&self, id: PropertyKeyId) -> Option<Arc<str>>
Gets the property key name for a property key ID, if it exists.
Sourcepub fn property_key_count(&self) -> usize
pub fn property_key_count(&self) -> usize
Returns the number of distinct property keys.
Sourcepub fn all_property_keys(&self) -> Vec<Arc<str>>
pub fn all_property_keys(&self) -> Vec<Arc<str>>
Returns all property key names.
Sourcepub fn get_or_create_edge_type(&self, name: &str) -> EdgeTypeId
pub fn get_or_create_edge_type(&self, name: &str) -> EdgeTypeId
Gets or creates an edge type ID for the given edge type name.
Sourcepub fn get_edge_type_id(&self, name: &str) -> Option<EdgeTypeId>
pub fn get_edge_type_id(&self, name: &str) -> Option<EdgeTypeId>
Gets the edge type ID for an edge type name, if it exists.
Sourcepub fn get_edge_type_name(&self, id: EdgeTypeId) -> Option<Arc<str>>
pub fn get_edge_type_name(&self, id: EdgeTypeId) -> Option<Arc<str>>
Gets the edge type name for an edge type ID, if it exists.
Sourcepub fn edge_type_count(&self) -> usize
pub fn edge_type_count(&self) -> usize
Returns the number of distinct edge types.
Sourcepub fn all_edge_types(&self) -> Vec<Arc<str>>
pub fn all_edge_types(&self) -> Vec<Arc<str>>
Returns all edge type names.
Sourcepub fn create_index(
&self,
label: LabelId,
property_key: PropertyKeyId,
index_type: IndexType,
) -> IndexId
pub fn create_index( &self, label: LabelId, property_key: PropertyKeyId, index_type: IndexType, ) -> IndexId
Creates a new index on a label and property key.
Sourcepub fn drop_index(&self, id: IndexId) -> bool
pub fn drop_index(&self, id: IndexId) -> bool
Drops an index by ID.
Sourcepub fn get_index(&self, id: IndexId) -> Option<IndexDefinition>
pub fn get_index(&self, id: IndexId) -> Option<IndexDefinition>
Gets the index definition for an index ID.
Sourcepub fn indexes_for_label(&self, label: LabelId) -> Vec<IndexId>
pub fn indexes_for_label(&self, label: LabelId) -> Vec<IndexId>
Finds indexes for a given label.
Sourcepub fn indexes_for_label_property(
&self,
label: LabelId,
property_key: PropertyKeyId,
) -> Vec<IndexId>
pub fn indexes_for_label_property( &self, label: LabelId, property_key: PropertyKeyId, ) -> Vec<IndexId>
Finds indexes for a given label and property key.
Sourcepub fn index_count(&self) -> usize
pub fn index_count(&self) -> usize
Returns the number of indexes.
Sourcepub fn has_schema(&self) -> bool
pub fn has_schema(&self) -> bool
Returns whether schema constraints are enabled.
Sourcepub fn add_unique_constraint(
&self,
label: LabelId,
property_key: PropertyKeyId,
) -> Result<(), CatalogError>
pub fn add_unique_constraint( &self, label: LabelId, property_key: PropertyKeyId, ) -> Result<(), CatalogError>
Adds a uniqueness constraint.
Returns an error if schema is not enabled or constraint already exists.
Sourcepub fn add_required_property(
&self,
label: LabelId,
property_key: PropertyKeyId,
) -> Result<(), CatalogError>
pub fn add_required_property( &self, label: LabelId, property_key: PropertyKeyId, ) -> Result<(), CatalogError>
Adds a required property constraint (NOT NULL).
Returns an error if schema is not enabled or constraint already exists.
Sourcepub fn is_property_required(
&self,
label: LabelId,
property_key: PropertyKeyId,
) -> bool
pub fn is_property_required( &self, label: LabelId, property_key: PropertyKeyId, ) -> bool
Checks if a property is required for a label.
Sourcepub fn is_property_unique(
&self,
label: LabelId,
property_key: PropertyKeyId,
) -> bool
pub fn is_property_unique( &self, label: LabelId, property_key: PropertyKeyId, ) -> bool
Checks if a property must be unique for a label.
Sourcepub fn schema(&self) -> Option<&SchemaCatalog>
pub fn schema(&self) -> Option<&SchemaCatalog>
Returns a reference to the schema catalog.
Sourcepub fn register_node_type(
&self,
def: NodeTypeDefinition,
) -> Result<(), CatalogError>
pub fn register_node_type( &self, def: NodeTypeDefinition, ) -> Result<(), CatalogError>
Registers a node type definition.
Sourcepub fn register_or_replace_node_type(&self, def: NodeTypeDefinition)
pub fn register_or_replace_node_type(&self, def: NodeTypeDefinition)
Registers or replaces a node type definition.
Sourcepub fn drop_node_type(&self, name: &str) -> Result<(), CatalogError>
pub fn drop_node_type(&self, name: &str) -> Result<(), CatalogError>
Drops a node type definition.
Sourcepub fn get_node_type(&self, name: &str) -> Option<NodeTypeDefinition>
pub fn get_node_type(&self, name: &str) -> Option<NodeTypeDefinition>
Gets a node type definition by name.
Sourcepub fn all_node_type_names(&self) -> Vec<String>
pub fn all_node_type_names(&self) -> Vec<String>
Returns all registered node type names.
Sourcepub fn register_edge_type_def(
&self,
def: EdgeTypeDefinition,
) -> Result<(), CatalogError>
pub fn register_edge_type_def( &self, def: EdgeTypeDefinition, ) -> Result<(), CatalogError>
Registers an edge type definition.
Sourcepub fn register_or_replace_edge_type_def(&self, def: EdgeTypeDefinition)
pub fn register_or_replace_edge_type_def(&self, def: EdgeTypeDefinition)
Registers or replaces an edge type definition.
Sourcepub fn drop_edge_type_def(&self, name: &str) -> Result<(), CatalogError>
pub fn drop_edge_type_def(&self, name: &str) -> Result<(), CatalogError>
Drops an edge type definition.
Sourcepub fn get_edge_type_def(&self, name: &str) -> Option<EdgeTypeDefinition>
pub fn get_edge_type_def(&self, name: &str) -> Option<EdgeTypeDefinition>
Gets an edge type definition by name.
Sourcepub fn register_graph_type(
&self,
def: GraphTypeDefinition,
) -> Result<(), CatalogError>
pub fn register_graph_type( &self, def: GraphTypeDefinition, ) -> Result<(), CatalogError>
Registers a graph type definition.
Sourcepub fn drop_graph_type(&self, name: &str) -> Result<(), CatalogError>
pub fn drop_graph_type(&self, name: &str) -> Result<(), CatalogError>
Drops a graph type definition.
Sourcepub fn register_schema_namespace(
&self,
name: String,
) -> Result<(), CatalogError>
pub fn register_schema_namespace( &self, name: String, ) -> Result<(), CatalogError>
Registers a schema namespace.
Sourcepub fn drop_schema_namespace(&self, name: &str) -> Result<(), CatalogError>
pub fn drop_schema_namespace(&self, name: &str) -> Result<(), CatalogError>
Drops a schema namespace.
Sourcepub fn alter_node_type_add_property(
&self,
type_name: &str,
property: TypedProperty,
) -> Result<(), CatalogError>
pub fn alter_node_type_add_property( &self, type_name: &str, property: TypedProperty, ) -> Result<(), CatalogError>
Adds a property to a node type.
Sourcepub fn alter_node_type_drop_property(
&self,
type_name: &str,
property_name: &str,
) -> Result<(), CatalogError>
pub fn alter_node_type_drop_property( &self, type_name: &str, property_name: &str, ) -> Result<(), CatalogError>
Drops a property from a node type.
Sourcepub fn alter_edge_type_add_property(
&self,
type_name: &str,
property: TypedProperty,
) -> Result<(), CatalogError>
pub fn alter_edge_type_add_property( &self, type_name: &str, property: TypedProperty, ) -> Result<(), CatalogError>
Adds a property to an edge type.
Sourcepub fn alter_edge_type_drop_property(
&self,
type_name: &str,
property_name: &str,
) -> Result<(), CatalogError>
pub fn alter_edge_type_drop_property( &self, type_name: &str, property_name: &str, ) -> Result<(), CatalogError>
Drops a property from an edge type.
Sourcepub fn alter_graph_type_add_node_type(
&self,
graph_type_name: &str,
node_type: String,
) -> Result<(), CatalogError>
pub fn alter_graph_type_add_node_type( &self, graph_type_name: &str, node_type: String, ) -> Result<(), CatalogError>
Adds a node type to a graph type.
Sourcepub fn alter_graph_type_drop_node_type(
&self,
graph_type_name: &str,
node_type: &str,
) -> Result<(), CatalogError>
pub fn alter_graph_type_drop_node_type( &self, graph_type_name: &str, node_type: &str, ) -> Result<(), CatalogError>
Drops a node type from a graph type.
Sourcepub fn alter_graph_type_add_edge_type(
&self,
graph_type_name: &str,
edge_type: String,
) -> Result<(), CatalogError>
pub fn alter_graph_type_add_edge_type( &self, graph_type_name: &str, edge_type: String, ) -> Result<(), CatalogError>
Adds an edge type to a graph type.
Sourcepub fn alter_graph_type_drop_edge_type(
&self,
graph_type_name: &str,
edge_type: &str,
) -> Result<(), CatalogError>
pub fn alter_graph_type_drop_edge_type( &self, graph_type_name: &str, edge_type: &str, ) -> Result<(), CatalogError>
Drops an edge type from a graph type.
Sourcepub fn bind_graph_type(
&self,
graph_name: &str,
graph_type: String,
) -> Result<(), CatalogError>
pub fn bind_graph_type( &self, graph_name: &str, graph_type: String, ) -> Result<(), CatalogError>
Binds a graph instance to a graph type.
Sourcepub fn get_graph_type_binding(&self, graph_name: &str) -> Option<String>
pub fn get_graph_type_binding(&self, graph_name: &str) -> Option<String>
Gets the graph type binding for a graph instance.
Sourcepub fn register_procedure(
&self,
def: ProcedureDefinition,
) -> Result<(), CatalogError>
pub fn register_procedure( &self, def: ProcedureDefinition, ) -> Result<(), CatalogError>
Registers a stored procedure.
Sourcepub fn replace_procedure(
&self,
def: ProcedureDefinition,
) -> Result<(), CatalogError>
pub fn replace_procedure( &self, def: ProcedureDefinition, ) -> Result<(), CatalogError>
Replaces or creates a stored procedure.
Sourcepub fn drop_procedure(&self, name: &str) -> Result<(), CatalogError>
pub fn drop_procedure(&self, name: &str) -> Result<(), CatalogError>
Drops a stored procedure.
Sourcepub fn get_procedure(&self, name: &str) -> Option<ProcedureDefinition>
pub fn get_procedure(&self, name: &str) -> Option<ProcedureDefinition>
Gets a stored procedure by name.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Catalog
impl !RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
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> 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 more