We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Relationship.init()
1 parent 33d493d commit 85d948cCopy full SHA for 85d948c
Sources/CoreModel/Entity.swift
@@ -52,3 +52,21 @@ public extension EntityDescription {
52
self.init(id: T.entityName, attributes: attributes, relationships: relationships)
53
}
54
55
+
56
+public extension Relationship {
57
58
+ init<Entity, DestinationEntity>(
59
+ id: Entity.CodingKeys,
60
+ entity: Entity.Type,
61
+ destination: DestinationEntity.Type,
62
+ type: RelationshipType,
63
+ inverseRelationship: DestinationEntity.CodingKeys
64
+ ) where Entity: CoreModel.Entity, DestinationEntity: CoreModel.Entity {
65
+ self.init(
66
+ id: PropertyKey(id),
67
+ type: type,
68
+ destinationEntity: destination.entityName,
69
+ inverseRelationship: PropertyKey(inverseRelationship)
70
+ )
71
+ }
72
+}
0 commit comments