pub trait QuerySource: Sealed {
// Required methods
fn count(&self) -> Count<'_, Self>
where Self: Sized;
fn get<V, K, I>(&self, key: I) -> Get<'_, Self, K, V>
where Self: Sized,
I: Into<KeyRange<K>>;
fn get_key<K, I>(&self, key_range: I) -> GetKey<'_, Self, K>
where Self: Sized,
I: Into<KeyRange<K>>;
fn get_all<V>(&self) -> GetAll<'_, Record, Self, V>
where Self: Sized;
fn get_all_keys<K>(&self) -> GetAll<'_, Key, Self, K>
where Self: Sized;
fn key_path(&self) -> Option<KeyPath>;
fn name(&self) -> String;
fn set_name(&self, name: &str);
}Expand description
Common functionality for making queries.
Required Methods§
Sourcefn count(&self) -> Count<'_, Self>where
Self: Sized,
fn count(&self) -> Count<'_, Self>where
Self: Sized,
Count the number of documents in the index/object store.
§Errors
| Error | Thrown when |
|---|---|
InvalidStateError | Thrown if this object store or index has been deleted. |
TransactionInactiveError | Thrown if the transaction associated with this operation is inactive. |
DataError | Thrown if the key or key range provided contains an invalid key. |
Sourcefn get<V, K, I>(&self, key: I) -> Get<'_, Self, K, V>
fn get<V, K, I>(&self, key: I) -> Get<'_, Self, K, V>
Get one record from the object store or index. Returns the first match if a non-only key is provided and multiple records match.
§Errors
| Error | Thrown when |
|---|---|
InvalidStateError | Thrown if this object store or index has been deleted. |
TransactionInactiveError | Thrown if the transaction associated with this operation is inactive. |
DataError | Thrown if the key or key range provided contains an invalid key. |
Sourcefn get_key<K, I>(&self, key_range: I) -> GetKey<'_, Self, K>
fn get_key<K, I>(&self, key_range: I) -> GetKey<'_, Self, K>
Return the first matching key selected by the specified query.
§Errors
| Error | Thrown when |
|---|---|
TransactionInactiveError | Thrown if the transaction associated with this operation is inactive. |
InvalidStateError | Thrown if this object store or index has been deleted. |
DataError | Thrown if the key or key range provided contains an invalid key. |
Sourcefn get_all<V>(&self) -> GetAll<'_, Record, Self, V>where
Self: Sized,
fn get_all<V>(&self) -> GetAll<'_, Record, Self, V>where
Self: Sized,
Get all records in the object store or index.
§Errors
| Error | Thrown when |
|---|---|
InvalidStateError | Thrown if this object store or index has been deleted. |
TransactionInactiveError | Thrown if the transaction associated with this operation is inactive. |
DataError | Thrown if the key or key range provided contains an invalid key. |
Sourcefn get_all_keys<K>(&self) -> GetAll<'_, Key, Self, K>where
Self: Sized,
fn get_all_keys<K>(&self) -> GetAll<'_, Key, Self, K>where
Self: Sized,
Get all keys in the object store or index.
§Errors
| Error | Thrown when |
|---|---|
InvalidStateError | Thrown if this object store or index has been deleted. |
TransactionInactiveError | Thrown if the transaction associated with this operation is inactive. |
DataError | Thrown if the key or key range provided contains an invalid key. |
Sourcefn set_name(&self, name: &str)
fn set_name(&self, name: &str)
Set the index/object store name.
§Errors
| Error | Thrown when |
|---|---|
InvalidStateError | Thrown if this object store or index has been deleted. |
TransactionInactiveError | Thrown if the transaction associated with this operation is inactive. |
ConstraintError | Thrown if an object store is already using the specified name. |