Skip to main content

CollectionStore

Trait CollectionStore 

Source
pub trait CollectionStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn push<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        collection: &'life1 str,
        value: T,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_all<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        collection: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, String>> + Send + 'async_trait>>
       where T: DeserializeOwned + Send + Sync + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn clear<'life0, 'life1, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn replace_all<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        collection: &'life1 str,
        values: Vec<T>,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

For data that is just a list of items with no natural key (e.g., Behavioral Insights) The database automatically handles row creation and ID generation.

Required Methods§

Source

fn push<'life0, 'life1, 'async_trait, T>( &'life0 self, collection: &'life1 str, value: T, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Appends a new value to the collection.

Note: The value type T MUST serialize into a JSON object-like structure (e.g. a standard struct with named fields). Tuple structs, arrays, or primitive types are not supported and will result in errors when saving to the store.

Source

fn get_all<'life0, 'life1, 'async_trait, T>( &'life0 self, collection: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, String>> + Send + 'async_trait>>
where T: DeserializeOwned + Send + Sync + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves all values in the collection.

Source

fn clear<'life0, 'life1, 'async_trait>( &'life0 self, collection: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Clears the entire collection.

Source

fn replace_all<'life0, 'life1, 'async_trait, T>( &'life0 self, collection: &'life1 str, values: Vec<T>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Replaces the entire collection with a new list of values.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§