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 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: '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 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: '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 'life0: 'async_trait,
'life1: 'async_trait,
Self: '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 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: '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 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: '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 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: '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 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
}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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Sourcefn 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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Returns the number of affected rows.
Sourcefn 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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
soft = true should set a deleted flag rather than removing the row.
Returns the number of affected rows.
fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Provided Methods§
Sourcefn 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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: '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.
Sourcefn execute_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
_statement: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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".