Skip to main content

CypherLite

Struct CypherLite 

Source
pub struct CypherLite { /* private fields */ }
Expand description

The main CypherLite database interface.

Implementations§

Source§

impl CypherLite

Source

pub fn open(config: DatabaseConfig) -> Result<Self, CypherLiteError>

Open or create a CypherLite database.

Source

pub fn execute(&mut self, query: &str) -> Result<QueryResult, CypherLiteError>

Execute a Cypher query string.

Source

pub fn execute_with_params( &mut self, query: &str, params: Params, ) -> Result<QueryResult, CypherLiteError>

Execute a Cypher query with parameters.

Source

pub fn engine(&self) -> &StorageEngine

Get a reference to the underlying storage engine.

Source

pub fn engine_mut(&mut self) -> &mut StorageEngine

Get a mutable reference to the underlying storage engine.

Source

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.

Source

pub fn list_scalar_functions(&self) -> Vec<(&str, &str)>

List all registered scalar functions as (name, version) pairs.

Source

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.

Source

pub fn list_index_plugins(&self) -> Vec<(&str, &str, &str)>

List all registered index plugins as (name, version, index_type) tuples.

Source

pub fn get_index_plugin(&self, name: &str) -> Option<&dyn IndexPlugin>

Get an immutable reference to a registered index plugin by name.

Source

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.

Source

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.

Source

pub fn list_serializers(&self) -> Vec<(&str, &str)>

List all registered serializers as (name, version) pairs.

Source

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.

Source

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.

Source

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.

Source

pub fn list_triggers(&self) -> Vec<(&str, &str)>

List all registered triggers as (name, version) pairs.

Source

pub fn begin(&mut self) -> Transaction<'_>

Begin a transaction (simplified - wraps execute calls).

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.