Expand description
§queriable_storage
queriable_storage
is a create that provides the QueriableDataStore that can be queried by multiple filters.
§Examples
use queriable_storage::QueriableDataStore;
struct Person {
first_name: &'static str,
last_name: &'static str,
age: u32,
}
let persons:Vec<Person> = vec![/* ...*/];
let storage: QueriableDataStore<Person> = persons.into();
let first_name_index = storage.get_index(|v| v.first_name);
let last_name_index = storage.get_index(|v| v.last_name);
let age_index = storage.get_index(|v| v.age);
let filtered: Vec<&Person> = storage
.filter(
(first_name_index.filter_eq("Isaiah") & last_name_index.filter_eq("Mccarthy"))
| (age_index.filter_lt(30) | age_index.filter_gte(60)),
)
.collect();
Structs§
- Contains all items that match a given filter. Can be combined with the bitwise logical operators (& |).
- Data structure that can be queried by multiple filters. Its not allowed to modify data after the generation of the data store.
- Index of a DataStore.