Kitura / Swift-Kuery-ORM

An ORM for Swift, built on Codable
Apache License 2.0
212 stars 30 forks source link

Add support for optional id fields #103

Closed kilnerm closed 5 years ago

kilnerm commented 5 years ago

This PR adds support for optional id fields within a model.

The Model protocol has two functions added with default implementations, getID and setID. The former of these is used to determine whether the Model instance has a non-nil id property. The latter is used to set the value of the id property if it is set by the database. The README has been updated with usage instructions.

kilnerm commented 5 years ago

I am going to close this PR for the time being as while it adds functioning support it will add some cost onto the standard execution path. I will revisit in the near future.