Skip to main content

WritableValueSet

Trait WritableValueSet 

Source
pub trait WritableValueSet: ValueSet {
    // Required methods
    fn insert_value<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
        record: &'life2 Record<Self::Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Record<Self::Value>, VantageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn replace_value<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
        record: &'life2 Record<Self::Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Record<Self::Value>, VantageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn patch_value<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
        partial: &'life2 Record<Self::Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Record<Self::Value>, VantageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
    ) -> Pin<Box<dyn Future<Output = Result<(), VantageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn delete_all<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), VantageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

Write operations on raw storage values with idempotent behavior.

See documentation for ValueSet for implementation example.

Required Methods§

Source

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

Insert value with a specific ID (often generated) (HTTP POST with ID)

Idempotent: Succeeds if no record exists with the given ID. If record already exists, must return success without overwriting data, returning original data.

Returns: Record as it was stored.

§Use Case

Generate unique ID and store record while avoiding duplicates.

Source

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

Replace the entire record at the specified ID (HTTP PUT)

Idempotent: Always succeeds, completely overwrites existing data if present. If possible, will remove/recreate record; therefore if record doesn’t contain certain attributes which were present in the database, those will be removed. If record does not exist, will create it.

Returns: Record as it was stored.

§Use Case

Replace with a new version of a record.

Source

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

Partially update a record by merging with the provided value (HTTP PATCH)

Fails if record doesn’t exist. The exact merge behavior depends on the storage implementation - typically merges object fields for JSON-like values.

Returns: Record as it was stored (not only the partial change).

§Use Case

Update only the modified fields of a record.

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 Self::Id, ) -> Pin<Box<dyn Future<Output = Result<(), VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Delete a record by ID (HTTP DELETE)

Idempotent: Always succeeds, even if the record doesn’t exist. This allows safe cleanup operations without checking existence first.

Source

fn delete_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Delete all records in the set (HTTP DELETE without ID)

Idempotent: All records in the set will be deleted. Executing several times is OK.

Execute on a subset of your entire database.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl WritableValueSet for Vista

Source§

fn insert_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 String, record: &'life2 Record<Value>, ) -> Pin<Box<dyn Future<Output = Result<Record<Value>, VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Vista: 'async_trait,

Source§

fn replace_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 String, record: &'life2 Record<Value>, ) -> Pin<Box<dyn Future<Output = Result<Record<Value>, VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Vista: 'async_trait,

Source§

fn patch_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 String, partial: &'life2 Record<Value>, ) -> Pin<Box<dyn Future<Output = Result<Record<Value>, VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Vista: 'async_trait,

Source§

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 String, ) -> Pin<Box<dyn Future<Output = Result<(), VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Vista: 'async_trait,

Source§

fn delete_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Vista: 'async_trait,

Implementors§