QueryableStore

Trait QueryableStore 

Source
pub trait QueryableStore<T>: Send + Sync {
    // Required methods
    fn apply_filters(&self, data: Vec<T>, filter: &Value) -> Vec<T>;
    fn apply_sort(&self, data: Vec<T>, sort: &str) -> Vec<T>;
    fn list_all(&self) -> Vec<T>;
}
Expand description

Trait for stores that support filtering and sorting

Implement this trait for stores that support generic querying with filters and sorting capabilities.

Required Methods§

Source

fn apply_filters(&self, data: Vec<T>, filter: &Value) -> Vec<T>

Apply filters to a collection of entities

§Parameters
  • data: Collection of entities to filter
  • filter: Filter criteria as JSON Value
§Returns

Filtered collection

Source

fn apply_sort(&self, data: Vec<T>, sort: &str) -> Vec<T>

Apply sorting to a collection of entities

§Parameters
  • data: Collection of entities to sort (will be modified)
  • sort: Sort expression (e.g., “field:asc” or “field:desc”)
§Returns

Sorted collection

Source

fn list_all(&self) -> Vec<T>

Get all entities (unfiltered, unsorted)

Implementors§