Skip to content

Database operation functors

Dariusz Rybicki requested to merge dev/db-operation-functors into main

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.

Merge request reports

Loading