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.
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.
This PR adds support for optional id fields within a model.
The Model protocol has two functions added with default implementations,
getID
andsetID
. The former of these is used to determine whether theModel
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.