hasMany(_:through:using:)

This commit is contained in:
Gwendal Roué committed 2019-03-04 08:52:07 +01:00
1 parent 6489c80846
commit addfa45d3a
2 files changed
+7 -6

No files matched your search

@@ -19,8 +19,9 @@ extension HasManyThroughAssociation: TableRequest where Destination: TableRecord
extension TableRecord {
public static func hasMany<Pivot, Target>(
_ target: Target,
through pivot: Pivot)
_ destination: Target.RowDecoder.Type,
through pivot: Pivot,
using target: Target)
-> HasManyThroughAssociation<Self, Target.RowDecoder>
where Pivot: Association,
Target: Association,
@@ -14,7 +14,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase {
func testBelongsToHasMany() throws {
struct A: MutablePersistableRecord {
static let b = belongsTo(B.self)
static let c = hasMany(B.c, through: b)
static let c = hasMany(C.self, through: b, using: B.c)
func encode(to container: inout PersistenceContainer) {
container["bId"] = 1
}
@@ -54,7 +54,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase {
func testHasOneHasMany() throws {
struct A: MutablePersistableRecord {
static let b = hasOne(B.self)
static let c = hasMany(B.c, through: b)
static let c = hasMany(C.self, through: b, using: B.c)
func encode(to container: inout PersistenceContainer) {
container["id"] = 1
}
@@ -94,7 +94,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase {
func testHasManyBelongsTo() throws {
struct A: MutablePersistableRecord {
static let b = hasMany(B.self)
static let c = hasMany(B.c, through: b)
static let c = hasMany(C.self, through: b, using: B.c)
func encode(to container: inout PersistenceContainer) {
container["id"] = 1
}
@@ -134,7 +134,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase {
func testHasManyHasOne() throws {
struct A: MutablePersistableRecord {
static let b = hasMany(B.self)
static let c = hasMany(B.c, through: b)
static let c = hasMany(C.self, through: b, using: B.c)
func encode(to container: inout PersistenceContainer) {
container["id"] = 1
}