Skip to main content

Operations

Trait Operations 

Source
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§

Source

fn insert<R>(&self, value: R) -> ApiResult<usize>
where R: Row,

Insert a value (row) into the database

Source

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

Source

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.

Source

fn select<T, P>(&self, value: P) -> ApiResult<Option<T>>
where T: Into<Table>, P: Params,

Select a value from the database

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§