pub struct CypherLite { /* private fields */ }Expand description
The main CypherLite database interface.
Implementations§
Source§impl CypherLite
impl CypherLite
Sourcepub fn open(config: DatabaseConfig) -> Result<Self, CypherLiteError>
pub fn open(config: DatabaseConfig) -> Result<Self, CypherLiteError>
Open or create a CypherLite database.
Sourcepub fn execute(&mut self, query: &str) -> Result<QueryResult, CypherLiteError>
pub fn execute(&mut self, query: &str) -> Result<QueryResult, CypherLiteError>
Execute a Cypher query string.
Sourcepub fn execute_with_params(
&mut self,
query: &str,
params: Params,
) -> Result<QueryResult, CypherLiteError>
pub fn execute_with_params( &mut self, query: &str, params: Params, ) -> Result<QueryResult, CypherLiteError>
Execute a Cypher query with parameters.
Sourcepub fn engine(&self) -> &StorageEngine
pub fn engine(&self) -> &StorageEngine
Get a reference to the underlying storage engine.
Sourcepub fn engine_mut(&mut self) -> &mut StorageEngine
pub fn engine_mut(&mut self) -> &mut StorageEngine
Get a mutable reference to the underlying storage engine.
Sourcepub fn register_scalar_function(
&mut self,
func: Box<dyn ScalarFunction>,
) -> Result<(), CypherLiteError>
pub fn register_scalar_function( &mut self, func: Box<dyn ScalarFunction>, ) -> Result<(), CypherLiteError>
Register a user-defined scalar function (plugin feature).
Returns an error if a function with the same name is already registered.
Sourcepub fn list_scalar_functions(&self) -> Vec<(&str, &str)>
pub fn list_scalar_functions(&self) -> Vec<(&str, &str)>
List all registered scalar functions as (name, version) pairs.
Sourcepub fn register_index_plugin(
&mut self,
plugin: Box<dyn IndexPlugin>,
) -> Result<(), CypherLiteError>
pub fn register_index_plugin( &mut self, plugin: Box<dyn IndexPlugin>, ) -> Result<(), CypherLiteError>
Register a custom index plugin.
Returns an error if an index plugin with the same name is already registered.
Sourcepub fn list_index_plugins(&self) -> Vec<(&str, &str, &str)>
pub fn list_index_plugins(&self) -> Vec<(&str, &str, &str)>
List all registered index plugins as (name, version, index_type) tuples.
Sourcepub fn get_index_plugin(&self, name: &str) -> Option<&dyn IndexPlugin>
pub fn get_index_plugin(&self, name: &str) -> Option<&dyn IndexPlugin>
Get an immutable reference to a registered index plugin by name.
Sourcepub fn get_index_plugin_mut(
&mut self,
name: &str,
) -> Option<&mut (dyn IndexPlugin + 'static)>
pub fn get_index_plugin_mut( &mut self, name: &str, ) -> Option<&mut (dyn IndexPlugin + 'static)>
Get a mutable reference to a registered index plugin by name.
Useful for calling insert() and remove() which require &mut self.
Sourcepub fn register_serializer(
&mut self,
serializer: Box<dyn Serializer>,
) -> Result<(), CypherLiteError>
pub fn register_serializer( &mut self, serializer: Box<dyn Serializer>, ) -> Result<(), CypherLiteError>
Register a custom serializer plugin.
Returns an error if a serializer with the same name is already registered.
Sourcepub fn list_serializers(&self) -> Vec<(&str, &str)>
pub fn list_serializers(&self) -> Vec<(&str, &str)>
List all registered serializers as (name, version) pairs.
Sourcepub fn export_data(
&mut self,
format: &str,
query: &str,
) -> Result<Vec<u8>, CypherLiteError>
pub fn export_data( &mut self, format: &str, query: &str, ) -> Result<Vec<u8>, CypherLiteError>
Export query results through a registered serializer.
Executes the given query, converts the resulting rows to
Vec<HashMap<String, PropertyValue>>, then delegates to the
serializer whose format() matches the requested format string.
Sourcepub fn import_data(
&self,
format: &str,
bytes: &[u8],
) -> Result<Vec<HashMap<String, PropertyValue>>, CypherLiteError>
pub fn import_data( &self, format: &str, bytes: &[u8], ) -> Result<Vec<HashMap<String, PropertyValue>>, CypherLiteError>
Import data through a registered serializer.
Looks up the serializer whose format() matches the requested format
string, then delegates to its import() method.
Sourcepub fn register_trigger(
&mut self,
trigger: Box<dyn Trigger>,
) -> Result<(), CypherLiteError>
pub fn register_trigger( &mut self, trigger: Box<dyn Trigger>, ) -> Result<(), CypherLiteError>
Register a custom trigger plugin.
Returns an error if a trigger with the same name is already registered.
Sourcepub fn list_triggers(&self) -> Vec<(&str, &str)>
pub fn list_triggers(&self) -> Vec<(&str, &str)>
List all registered triggers as (name, version) pairs.
Sourcepub fn begin(&mut self) -> Transaction<'_>
pub fn begin(&mut self) -> Transaction<'_>
Begin a transaction (simplified - wraps execute calls).