pub struct Query<'a> { /* private fields */ }Expand description
A Query refers to a query which you can read or listen to.
You can also construct refined Query objects by adding filters and ordering.
Implementations§
Source§impl<'a> Query<'a>
impl<'a> Query<'a>
Sourcepub fn where_filter<T: Serialize>(
&self,
field: &str,
op: FieldOperator,
value: T,
) -> Result<Query<'a>, FirestoreError>
pub fn where_filter<T: Serialize>( &self, field: &str, op: FieldOperator, value: T, ) -> Result<Query<'a>, FirestoreError>
Creates and returns a new Query with the additional filter.
§Arguments
field- The path of the field to filter (e.g., “age”).op- The operation to apply.value- The value to compare against.
Sourcepub fn order_by(&self, field: &str, direction: Direction) -> Query<'a>
pub fn order_by(&self, field: &str, direction: Direction) -> Query<'a>
Creates and returns a new Query that’s additionally sorted by the specified field.
Sourcepub fn limit(&self, limit: i32) -> Query<'a>
pub fn limit(&self, limit: i32) -> Query<'a>
Creates and returns a new Query that only returns the first matching documents.
Sourcepub fn offset(&self, offset: i32) -> Query<'a>
pub fn offset(&self, offset: i32) -> Query<'a>
Creates and returns a new Query that skips the first matching documents.
Sourcepub async fn get(&self) -> Result<QuerySnapshot<'a>, FirestoreError>
pub async fn get(&self) -> Result<QuerySnapshot<'a>, FirestoreError>
Executes the query and returns the results as a QuerySnapshot.
Sourcepub async fn listen(&self) -> Result<ListenStream, FirestoreError>
pub async fn listen(&self) -> Result<ListenStream, FirestoreError>
Listens to changes to the query results.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Query<'a>
impl<'a> !RefUnwindSafe for Query<'a>
impl<'a> Send for Query<'a>
impl<'a> Sync for Query<'a>
impl<'a> Unpin for Query<'a>
impl<'a> !UnwindSafe for Query<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more