Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Query<T>

Firestorm representation of a query. Queries can be chained together, as per the standard firestore SDK.

Type parameters

  • T: Entity

    The entity for the query.

Hierarchy

  • Query

Implements

Index

Constructors

constructor

  • Create a collection query for an Entity.

    Parameters

    • Entity: object

      T The entity to represent.

    • collection: ICollection<T>

      The collection to query.

    • fields: Map<string, IFieldMeta>

      The list of field for the collection.

    • native: Query

      The native firestore query.

    Returns Query

Properties

Private _Entity

_Entity: object

Type declaration

Private _collection

_collection: ICollection<T>

Private _fields

_fields: Map<string, IFieldMeta>

Private _native

_native: Query

Methods

Private appendNativeQuery

  • appendNativeQuery(query: Query): Query<T>
  • Appends a query to the current query.

    Parameters

    • query: Query

      The query to append.

    Returns Query<T>

Private buildSnapshot

  • Creates a firestorm snapshot from the firestore snapshot.

    Parameters

    • nativeSnapshot: QuerySnapshot

      The native query document snapshot.

    Returns QuerySnapshot<T>

endAt

  • endAt(...fieldValues: any[]): Query<T>
  • Applies an end at filter to the query.

    Parameters

    • Rest ...fieldValues: any[]

      The field values to end this query at, in order of the query's order by.

    Returns Query<T>

endBefore

  • endBefore(...fieldValues: any[]): Query<T>
  • Applies an end before filter to the query.

    Parameters

    • Rest ...fieldValues: any[]

      The field values to end this query before, in order of the query's order by.

    Returns Query<T>

get

limit

  • limit(amount: number): Query<T>
  • Applies a limit filter to the query.

    Parameters

    • amount: number

      The maximum number of documents to return.

    Returns Query<T>

onSnapshot

  • onSnapshot(onNext: function, onError?: undefined | function): function
  • Attaches a listener to the query.

    Parameters

    • onNext: function

      Callback which is called when new snapshot is available.

    • Optional onError: undefined | function

      Callback which is called when an error occurs.

    Returns function

    An unsubscribe function.

      • (): void
      • Returns void

orderBy

  • orderBy(property: keyof T, sort?: firestore.OrderByDirection): Query<T>
  • Applies an order by filter to the query.

    Parameters

    • property: keyof T

      The property to order by.

    • Optional sort: firestore.OrderByDirection

      The order direction. Default value is ascending.

    Returns Query<T>

startAfter

  • startAfter(...fieldValues: any[]): Query<T>
  • Applies a start after filter to the query.

    Parameters

    • Rest ...fieldValues: any[]

      The field values to start this query after, in order of the query's order by.

    Returns Query<T>

startAt

  • startAt(...fieldValues: any[]): Query<T>
  • Applies a start at filter to the query.

    Parameters

    • Rest ...fieldValues: any[]

      The field values to start this query at, in order of the query's order by.

    Returns Query<T>

where

  • where(property: keyof T, op: firestore.WhereFilterOp, value: any): Query<T>
  • Applies a where filter to the query.

    Parameters

    • property: keyof T

      The property to query.

    • op: firestore.WhereFilterOp

      The operation to apply.

    • value: any

      The value to test for.

    Returns Query<T>

Generated using TypeDoc