QuerySource

Trait QuerySource 

Source
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§

Source

fn count(&self) -> Count<'_, Self>
where Self: Sized,

Count the number of documents in the index/object store.

§Errors
ErrorThrown when
InvalidStateErrorThrown if this object store or index has been deleted.
TransactionInactiveErrorThrown if the transaction associated with this operation is inactive.
DataErrorThrown if the key or key range provided contains an invalid key.
Source

fn get<V, K, I>(&self, key: I) -> Get<'_, Self, K, V>
where Self: Sized, I: Into<KeyRange<K>>,

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
ErrorThrown when
InvalidStateErrorThrown if this object store or index has been deleted.
TransactionInactiveErrorThrown if the transaction associated with this operation is inactive.
DataErrorThrown if the key or key range provided contains an invalid key.
Source

fn get_key<K, I>(&self, key_range: I) -> GetKey<'_, Self, K>
where Self: Sized, I: Into<KeyRange<K>>,

Return the first matching key selected by the specified query.

§Errors
ErrorThrown when
TransactionInactiveErrorThrown if the transaction associated with this operation is inactive.
InvalidStateErrorThrown if this object store or index has been deleted.
DataErrorThrown if the key or key range provided contains an invalid key.
Source

fn get_all<V>(&self) -> GetAll<'_, Record, Self, V>
where Self: Sized,

Get all records in the object store or index.

§Errors
ErrorThrown when
InvalidStateErrorThrown if this object store or index has been deleted.
TransactionInactiveErrorThrown if the transaction associated with this operation is inactive.
DataErrorThrown if the key or key range provided contains an invalid key.
Source

fn get_all_keys<K>(&self) -> GetAll<'_, Key, Self, K>
where Self: Sized,

Get all keys in the object store or index.

§Errors
ErrorThrown when
InvalidStateErrorThrown if this object store or index has been deleted.
TransactionInactiveErrorThrown if the transaction associated with this operation is inactive.
DataErrorThrown if the key or key range provided contains an invalid key.
Source

fn key_path(&self) -> Option<KeyPath>

Get the index/object store key path.

Source

fn name(&self) -> String

Get the index/object store name.

Source

fn set_name(&self, name: &str)

Set the index/object store name.

§Errors
ErrorThrown when
InvalidStateErrorThrown if this object store or index has been deleted.
TransactionInactiveErrorThrown if the transaction associated with this operation is inactive.
ConstraintErrorThrown if an object store is already using the specified name.

Implementors§

Source§

impl<T, R> QuerySource for T
where T: SystemRepr<Repr = R>, R: QuerySourceInternal,