Skip to main content

Storage

Trait Storage 

Source
pub trait Storage: Send + Sync {
    // Required methods
    fn list<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        opts: &'life2 QueryOptions,
    ) -> Pin<Box<dyn Future<Output = Result<ListPage, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        pk: &'life2 str,
        id: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Value>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        data: Map<String, Value>,
    ) -> Pin<Box<dyn Future<Output = Result<CreateOutcome, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        pk: &'life2 str,
        id: &'life3 str,
        data: Map<String, Value>,
    ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        pk: &'life2 str,
        id: &'life3 str,
        soft: bool,
    ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn health<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn find_one_by<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _table: &'life1 str,
        _column: &'life2 str,
        _value: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Value>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn execute_raw<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _statement: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn list<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, opts: &'life2 QueryOptions, ) -> Pin<Box<dyn Future<Output = Result<ListPage, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, table: &'life1 str, pk: &'life2 str, id: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Value>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, data: Map<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<CreateOutcome, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn update<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, table: &'life1 str, pk: &'life2 str, id: &'life3 str, data: Map<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Returns the number of affected rows.

Source

fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, table: &'life1 str, pk: &'life2 str, id: &'life3 str, soft: bool, ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

soft = true should set a deleted flag rather than removing the row. Returns the number of affected rows.

Source

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn find_one_by<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _table: &'life1 str, _column: &'life2 str, _value: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Value>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Fetch the first row where column = value. Used by auth to look up an admin user by email. Backends that don’t support it inherit the default (unsupported); SQL/Mongo backends override it.

Source

fn execute_raw<'life0, 'life1, 'async_trait>( &'life0 self, _statement: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a raw, backend-specific statement — SQL for SeaORM (e.g. an INSERT/CREATE TABLE), or a JSON command document for Mongo (e.g. {"insert":"products","documents":[{...}]}). Intended for seeding and migrations. Returns the number of affected records where the backend reports it. Backends that don’t support it inherit this error default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§