Skip to main content

InsertableValueSet

Trait InsertableValueSet 

Source
pub trait InsertableValueSet: ValueSet {
    // Required method
    fn insert_return_id_value<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record: &'life1 Record<Self::Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Id>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Append-only operations on raw storage values with automatic ID generation.

See documentation for ValueSet for implementation example.

Required Methods§

Source

fn insert_return_id_value<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 Record<Self::Value>, ) -> Pin<Box<dyn Future<Output = Result<Self::Id>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert a value and return the generated ID (Similar to HTTP POST without ID)

The storage backend generates a unique identifier for the new record.

§Warning

This method is not idempotent - each call creates a new record with a new ID, even if the value data is identical.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<E> InsertableValueSet for ImTable<E, Value>
where E: Send + Sync,

InsertableValueSet is only available for V = serde_json::Value because it inspects the record for an "id" field via JSON-specific accessors (as_str, as_u64, …). CBOR consumers carry their own id generation upstream (e.g. MockTableSource::insert_table_value constructs the id before calling into ImTable).