Closed coffee-cup closed 5 years ago
export interface Query<T> { where?: [ [keyof T, firebase.firestore.WhereFilterOp, any], // field, op, value ]; orderBy?: [[keyof T] | [keyof T, "asc" | "desc"]]; limit?: number; }
watchAll
db_cache.docs
This plugin is not finalized yet as it isn't testable. The next step is to allow passing in fixtures that can mock firestore.
Type of Collection is
Collection
export interface Collection<T extends { id: string }> { ref: (key: string) => firebase.firestore.CollectionReference; // methods for actions get: (id: string) => Promise<T>; getAll: () => Promise<T[]>; set: (id: string, value: Partial<T>) => Promise<void>; delete: (id: string) => Promise<void>; insert: (value: Omit<T, "id">) => Promise<string>; query: (query: Query<T>) => Promise<T[]>; // methods for react components watch: (id: string) => Fetching<T>; watchAll: (query?: Query<T>) => FetchAll<T>; }
watchAll
to take in an optional querydb_cache.docs
should always be kept up to date with what is being watchedThis plugin is not finalized yet as it isn't testable. The next step is to allow passing in fixtures that can mock firestore.
Type of
Collection
is