Kitura / Swift-Kuery-ORM

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

Add defaultDatabase property in Model Protocol #126

Open nick6969 opened 4 years ago

nick6969 commented 4 years ago

Description

If there are multiple databases at the same time, Any Query must specify database, Cannot use Datebase.dafault directly.

// if not using Datebase.dafault
struct Amodel: Model { }

// every time using find / findAll / save / update .... need put using parameter
// even always same property
Amodel.find(id: 1, using: Database.abc) { model, error in
     // do somrthing
}

But Model is mean the record struct in the specific table and specific database. We allow Model specify table, Why not let Model specify Database?

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.