Database operation functors
This MR refactors database operations into functors (structs with closures), making the source code structure cleaner. In addition, it's now possible to use @discardableResult
for database operations like insert
, update
, save
, and delete
(thanks for the feedback @brunomunizaf!).
The only change visible from the library consumer, is that now the model operations are defined as structs, instead of closures:
extension Contact {
- public typealias Fetch = (Query) throws -> [Contact]
+ public typealias Fetch = XXModels.Fetch<Contact, Query>
}
The rest of the changes are just cosmetics, like source files organization, etc.