Releases: SHcommit/SHFirestoreService
Releases · SHcommit/SHFirestoreService
[Fix] Remove meaningless casting operators
[Fix] Remove wrong working casting operators
/// This protocol defines objects that can access Firestore.
public protocol FirestoreAccessible {
var collectionRef: CollectionReference { get }
var documentRef: DocumentReference? { get }
}
// MARK: - Helpers
public extension FirestoreAccessible {
var asCollectionRef: CollectionReference? {
return self as? CollectionReference
}
var asDocumentRef: DocumentReference? {
return self as? DocumentReference
}
}
- remove asCollectionRef, asDocumentRef.
It can be used without a where condition, whether the implementation of firestoreAccessible refers to a Collection or Document Ref. In this case, an error occurred, so I removed this code.😅
[Fix] isDocumentExists makeQuery closure's input param type modify FirestoreReference -> CollectionReference
[Fix] isDocumentExists makeQuery closure's input param type modify FirestoreReference -> CollectionReference
Latest
[Fix]
- isDocumentExists makeQuery closure's input param type modify FirestoreReference -> CollectionReference.
- to handle references more clearly
[Feat] Now a document exists checking is available to query specific document's filtering for using where field.
[Feature] isDocumentExists func.
Previously, when the endpoint's firestoreAccessible type was a specific document path, a bool value could be received to determine whether the document exists.
Now you can find through query whether a specific document exists for a collection.
[Feat] Change specific extension helpers access control from internal to public
[Feat] Change specific extension helpers access control from internal to public
[Feature] FirestoreDocumentSupportable protocol
[Feature]
- Declared the
isDocumentExists
function in the FirestoreDocumentSupportable protocol. - Implemented
isDocumentExists
function in FirestoreService
[Feature] the number of documents in a collection Retrieve logic implementation.
[Feature]
- Retrieve the number of documents in a collection using aggressive query logic implement in request(endpoint:)
- It execute to retrieve the number of all documents in a specified collectionRef from FirestoreAccessible.
- This method using AggrateQuery's count() that match between 0 and 1000 index entries billed for one documen read: ]
- Set Endpoint's responseDTO's type Int and FirestoreAccessible must return CollectionReference without DocumentReference and then use this method: ]
[References]
- official Document aggregation-queries link
- official Document AggregateSource link
- stackOverflow Cloud Firestore collection count
[Fix] Modified unexpected logic
[Fix] Modified unexpected logic
- Modified unexpected logic in request(endpoint:).
- "FirestoreMethod case .deleteACollection" was never called, becuse endpoint's request documentRef instance check logic was located at the top.
[Feat] Add batch function and a collection document delete logic, FirestoreMethod type
[Feautre]
- Implemented logic to delete all documents in a collection using batch.
- improved, including saving some redundant logic using Combine+extension.
- Previously, when receiving collection documents, the endpoints response DTO type was specified as a single type even if it had to be received as an array, but now it must be specified as an array. 🤩
[Example]
- When deleting all documents in a collection, set the FirestoreMethod type to deleteADocument.
- And then, call a request(endpoint:) func using FirestoreService object ! delete it.
- Before deletion, FirestoreAccessible's documentRef must be nil and collectionRef must be specified as the deletion target path in the endpoint.
References:
[Feature] Append publisher's helper mehtods
[Feature]
- Define sink(promise:) helpers when the publisher's Output value is Void and Future's promise is used
[Feature] Add throw error in FirestoreQueryHandler and handle in FirestoreService
[Feature]
- In FirestoreQueryable, it is now possible to throw an error in the FirestoreQueryHandler closure!!
- Casting computed properties is now possible in FirestoreAccessible😄