pub trait Operations {
// Required methods
fn insert<R>(&self, value: R) -> ApiResult<usize>
where R: Row;
fn persist<'life0, 'async_trait, P>(
&'life0 self,
data: Option<P>,
) -> Pin<Box<dyn Future<Output = ApiResult<usize>> + Send + 'async_trait>>
where P: DatabasePersistence + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn populate<'life0, 'async_trait>(
&'life0 self,
table: impl 'async_trait + TableSchemaProvider + Send,
) -> Pin<Box<dyn Future<Output = ApiResult<PersistStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn select<T, P>(&self, value: P) -> ApiResult<Option<T>>
where T: Into<Table>,
P: Params;
}Expand description
Write and access data in a database
Required Methods§
Sourcefn insert<R>(&self, value: R) -> ApiResult<usize>where
R: Row,
fn insert<R>(&self, value: R) -> ApiResult<usize>where
R: Row,
Insert a value (row) into the database
Sourcefn persist<'life0, 'async_trait, P>(
&'life0 self,
data: Option<P>,
) -> Pin<Box<dyn Future<Output = ApiResult<usize>> + Send + 'async_trait>>where
P: DatabasePersistence + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn persist<'life0, 'async_trait, P>(
&'life0 self,
data: Option<P>,
) -> Pin<Box<dyn Future<Output = ApiResult<usize>> + Send + 'async_trait>>where
P: DatabasePersistence + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Save data to database
Sourcefn populate<'life0, 'async_trait>(
&'life0 self,
table: impl 'async_trait + TableSchemaProvider + Send,
) -> Pin<Box<dyn Future<Output = ApiResult<PersistStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn populate<'life0, 'async_trait>(
&'life0 self,
table: impl 'async_trait + TableSchemaProvider + Send,
) -> Pin<Box<dyn Future<Output = ApiResult<PersistStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Download and persist data for a table if the table is empty.
Returns PersistStatus::Downloaded(n) if data was downloaded and persisted,
or PersistStatus::AlreadyExists if the table already contained data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".