Datastore

Trait Datastore 

Source
pub trait Datastore:
    Send
    + Sync
    + Any {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = DbResult<Option<Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8],
        value: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = DbResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn has<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = DbResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = DbResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn query<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 Query,
    ) -> Pin<Box<dyn Future<Output = DbResult<Results>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_keys<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = DbResult<Vec<Key>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Trait principal para operações de datastore

Fornece uma interface assíncrona para operações CRUD básicas e queries com filtros avançados.

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = DbResult<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Recupera um valor associado à chave

Source

fn put<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 [u8], value: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = DbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Armazena um valor com a chave especificada

Source

fn has<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = DbResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verifica se uma chave existe no datastore

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = DbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove uma chave e seu valor do datastore

Source

fn query<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 Query, ) -> Pin<Box<dyn Future<Output = DbResult<Results>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executa uma query com filtros e retorna resultados paginados

Source

fn list_keys<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = DbResult<Vec<Key>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retorna todas as chaves com um determinado prefixo

Source

fn as_any(&self) -> &dyn Any

Método auxiliar para downcast

Implementors§