You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some feedback based on the examples in the pitch for the SSWG incubation process: for the API methods that allow returning a model object, it seems worth considering accepting the model type as an explicit parameter, for example something like:
letresult=tryawait session.query("select * from table ...", withModelType:Model.self)
While the type annotations get the job done, I think the explicit parameter is more discoverable for users, and seems more consistent with other Swift APIs. Most notably perhaps JSONDecoder:
let result = try JSONEncoder().decode(Model.self, from: myData)
Some feedback based on the examples in the pitch for the SSWG incubation process: for the API methods that allow returning a model object, it seems worth considering accepting the model type as an explicit parameter, for example something like:
While the type annotations get the job done, I think the explicit parameter is more discoverable for users, and seems more consistent with other Swift APIs. Most notably perhaps
JSONDecoder
:But there are various other examples of this around the ecosystem too, e.g.
ByteBuffer.getInteger
orEventLoop.makePromise
.We've got some similar API methods in the MongoDB driver and we went with explicit type parameters for this reason.
The text was updated successfully, but these errors were encountered: