The AllDatabaseDocuments struct returns a [[String: Any]] since it can be an array of multiple different types of Document. This PR adds a helper function:
which will decode you all the document of the given type. This saves the user from having to handle the raw JSON.
We also add a new initializer for BulkDocuments:
init<T: Document>(encoding: [T])
That will create a bulk document struct by encoding an array of Documents instead of from a [[String: Any]].
Finally we have updated the copyright to 2019.
Motivation and Context
Despite the general improvement of the API, the retrieveAll and Bulk functions still use raw JSON that needs to be decoded into regular objects. Through supporting these new methods, this is now achievable without having to worry about manual serialization.
How Has This Been Tested?
I have tested this function for the only two possible use cases regarding the parameter passed to retrieveAll, and each case has been tested twice over.
Description
The AllDatabaseDocuments struct returns a
[[String: Any]]
since it can be an array of multiple different types of Document. This PR adds a helper function:which will decode you all the document of the given type. This saves the user from having to handle the raw JSON.
We also add a new initializer for BulkDocuments:
That will create a bulk document struct by encoding an array of Documents instead of from a
[[String: Any]]
.Finally we have updated the copyright to 2019.
Motivation and Context
Despite the general improvement of the API, the retrieveAll and Bulk functions still use raw JSON that needs to be decoded into regular objects. Through supporting these new methods, this is now achievable without having to worry about manual serialization.
How Has This Been Tested?
I have tested this function for the only two possible use cases regarding the parameter passed to retrieveAll, and each case has been tested twice over.
Checklist: