src/lib/interfaces.ts
Properties |
Methods |
add | |||||||||
add(collectionRef: CollectionReference
|
|||||||||
Defined in src/lib/interfaces.ts:54
|
|||||||||
Type parameters :
|
|||||||||
Parameters :
Returns :
Observable<DocumentReference<T>>
|
delete | ||||||
delete(docRef: DocumentReference
|
||||||
Defined in src/lib/interfaces.ts:58
|
||||||
Type parameters :
|
||||||
Parameters :
Returns :
Observable<void>
|
getCollection | ||||||
getCollection(query: Query
|
||||||
Defined in src/lib/interfaces.ts:64
|
||||||
Type parameters :
|
||||||
get collection
Parameters :
Returns :
Observable<QuerySnapshot<T>>
|
getDoc | ||||||
getDoc(docRef: DocumentReference
|
||||||
Defined in src/lib/interfaces.ts:50
|
||||||
Type parameters :
|
||||||
get document
Parameters :
Returns :
Observable<DocumentSnapshot<T>>
|
listenForCollection | ||||||
listenForCollection(query: Query
|
||||||
Defined in src/lib/interfaces.ts:61
|
||||||
Type parameters :
|
||||||
get collection and listen for real time updates
Parameters :
Returns :
Observable<QuerySnapshot<T>>
|
listenForDoc | ||||||
listenForDoc(docRef: DocumentReference
|
||||||
Defined in src/lib/interfaces.ts:47
|
||||||
Type parameters :
|
||||||
get document and listen for real time updates
Parameters :
Returns :
Observable<DocumentSnapshot<T>>
|
set | ||||||||||||
set(docRef: DocumentReference
|
||||||||||||
Defined in src/lib/interfaces.ts:52
|
||||||||||||
Type parameters :
|
||||||||||||
Parameters :
Returns :
Observable<void>
|
update | ||||||||||||
update(docRef: DocumentReference
|
||||||||||||
Defined in src/lib/interfaces.ts:56
|
||||||||||||
Type parameters :
|
||||||||||||
Parameters :
Returns :
Observable<void>
|
firebaseApp |
firebaseApp:
|
Type : FirebaseApp
|
import {Observable} from 'rxjs';
import {
CollectionReference,
DocumentData,
DocumentReference,
DocumentSnapshot,
Firestore,
FirestoreError,
Query,
QuerySnapshot,
SetOptions,
UpdateData
} from 'firebase/firestore';
import {FirebaseApp} from 'firebase/app';
// export type Query<T = DocumentData> = FirestoreQuery<T>;
// A convenience type for making a query.
// Example: const query = (ref) => ref.where('name', == 'david');
// export type QueryFn<T = DocumentData> = (ref: CollectionReference<T>) => Query<T>;
// export declare type FirestoreErrorCodeExt = 'sdsdsd' & FirestoreErrorCode;
export interface FirestoreErrorExt extends FirestoreError, DocumentData {
}
/** Used as a wrapper for adding a document, either doc or path must be specified, helps when adding multiple */
export interface AddDocumentWrapper<A> {
/** The data to be added */
data: A;
/** Reference to the Document */
ref?: DocumentReference;
/** The path to the Document */
path?: string;
}
export interface BaseFirestoreWrapper {
firebaseApp: FirebaseApp;
get firestore(): Firestore;
/** get document and listen for real time updates */
listenForDoc<T>(docRef: DocumentReference<T>): Observable<DocumentSnapshot<T>>;
/** get document */
getDoc<T>(docRef: DocumentReference<T>): Observable<DocumentSnapshot<T>>;
set<T>(docRef: DocumentReference<T>, data: T, options?: SetOptions): Observable<void>;
add<T>(collectionRef: CollectionReference<T>, data: T): Observable<DocumentReference<T>>;
update<T>(docRef: DocumentReference<T>, data: UpdateData<Partial<T>>, options?: SetOptions): Observable<void>;
delete<T>(docRef: DocumentReference<T>): Observable<void>;
/** get collection and listen for real time updates */
listenForCollection<T>(query: Query<T>): Observable<QuerySnapshot<T>>;
/** get collection */
getCollection<T>(query: Query<T>): Observable<QuerySnapshot<T>>;
}