UNPKG

@rikishi/watermelondb

Version:

Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast

40 lines (26 loc) 1.23 kB
declare module '@rikishi/watermelondb/Query' { import { Collection, ColumnName, Model, TableName, RecordId } from '@rikishi/watermelondb' import { AssociationInfo } from '@rikishi/watermelondb/Model' import { Clause, QueryDescription } from '@rikishi/watermelondb/QueryDescription' import { Observable } from 'rxjs' export type QueryAssociation = { from: TableName<any>; to: TableName<any>; info: AssociationInfo } export interface SerializedQuery { table: TableName<any> description: QueryDescription associations: QueryAssociation[] } export default class Query<Record extends Model> { public collection: Collection<Record> public description: QueryDescription public extend(...conditions: Clause[]): Query<Record> public pipe<T>(transform: (this: this) => T): T public fetch(): Promise<Record[]> public observe(): Observable<Record[]> public observeWithColumns(rawFields: ColumnName[]): Observable<Record[]> public fetchIds(): Promise<RecordId[]> public fetchCount(): Promise<number> public observeCount(isThrottled?: boolean): Observable<number> public markAllAsDeleted(): Promise<void> public destroyAllPermanently(): Promise<void> } }