Skip to main content

Store

Trait Store 

Source
pub trait Store: Send + Sync {
    // Required methods
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 CollectionQuery,
    ) -> Pin<Box<dyn Future<Output = Result<LinoValue, LinoHttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        identifier: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<LinoValue>, LinoHttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        body: &'life1 LinoValue,
    ) -> Pin<Box<dyn Future<Output = Result<LinoValue, LinoHttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        identifier: &'life1 str,
        body: &'life2 LinoValue,
    ) -> Pin<Box<dyn Future<Output = Result<Option<LinoValue>, LinoHttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn patch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        identifier: &'life1 str,
        body: &'life2 LinoValue,
    ) -> Pin<Box<dyn Future<Output = Result<Option<LinoValue>, LinoHttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        identifier: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, LinoHttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn id_field(&self) -> &str { ... }
}
Expand description

What a store must be able to do for crate::resource::register_resource.

Every method is asynchronous, so a store may read from a database, and every one may fail with a LinoHttpError, so a store may refuse a write with any status it likes.

Required Methods§

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 CollectionQuery, ) -> Pin<Box<dyn Future<Output = Result<LinoValue, LinoHttpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run a collection query, returning a collection envelope.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, identifier: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<LinoValue>, LinoHttpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read one item, or None when it does not exist.

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, body: &'life1 LinoValue, ) -> Pin<Box<dyn Future<Output = Result<LinoValue, LinoHttpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create an item, assigning an identifier when the body carries none.

Source

fn update<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, identifier: &'life1 str, body: &'life2 LinoValue, ) -> Pin<Box<dyn Future<Output = Result<Option<LinoValue>, LinoHttpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Replace an item, or None when it does not exist.

Source

fn patch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, identifier: &'life1 str, body: &'life2 LinoValue, ) -> Pin<Box<dyn Future<Output = Result<Option<LinoValue>, LinoHttpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Merge changes into an item, or None when it does not exist.

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, identifier: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, LinoHttpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete an item, reporting whether one was deleted.

Provided Methods§

Source

fn id_field(&self) -> &str

The field of an item that holds its identifier.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§