Skip to content

Commit

Permalink
getDocuments with source
Browse files Browse the repository at this point in the history
arnauddorgans committed May 10, 2019
1 parent 4f00544 commit f2c0692
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/Firestore/FIRQuery+Rx.swift
Original file line number Diff line number Diff line change
@@ -28,6 +28,23 @@ extension Reactive where Base: Query {
return Disposables.create()
}
}

/**
* Reads the documents matching this query.
*/
public func getDocuments(source: FirestoreSource) -> Observable<QuerySnapshot> {
return Observable<QuerySnapshot>.create { observer in
self.base.getDocuments(source: source) { snapshot, error in
if let error = error {
observer.onError(error)
} else if let snapshot = snapshot {
observer.onNext(snapshot)
}
observer.onCompleted()
}
return Disposables.create()
}
}

/**
* Reads the first document matching this query.

0 comments on commit f2c0692

Please sign in to comment.