mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Decouple associations from TableRecord
Associations is generic for type safety, not for defining the association (just as QueryInterfaceRequest)
This commit is contained in:
1 parent
bc5ba1fda5
commit
8bf9e5e30f
9 files changed
+62
-26
No files matched your search
@@ -186,6 +186,19 @@ struct SQLRelation {
|
||||
}
|
||||
}
|
||||
|
||||
extension SQLRelation {
|
||||
/// Convenience factory methods which selects all rows from a table.
|
||||
static func all(
|
||||
fromTable tableName: String,
|
||||
selection: @escaping (Database) -> [SQLSelectable] = { _ in [AllColumns()] })
|
||||
-> Self
|
||||
{
|
||||
SQLRelation(
|
||||
source: SQLSource(tableName: tableName, alias: nil),
|
||||
selectionPromise: DatabasePromise(selection))
|
||||
}
|
||||
}
|
||||
|
||||
extension SQLRelation: Refinable {
|
||||
func select(_ selection: @escaping (Database) throws -> [SQLSelectable]) -> Self {
|
||||
with(\.selectionPromise, DatabasePromise(selection))
|
||||
|
||||
Reference in new issue
Block a user