pub struct Catalog { /* private fields */ }Expand description
The main database catalog.
Manages all metadata about the database schema including:
- Labels (node categories)
- Property keys (property names)
- Edge types (relationship types)
- Index definitions
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn with_schema() -> Self
pub fn with_schema() -> Self
Creates a new catalog with schema constraints 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.