WIP: Migrations

This commit is contained in:
John Estropia
2017-04-20 20:26:11 +09:00
parent a543a4c94a
commit 02a660e4a6
11 changed files with 205 additions and 77 deletions

View File

@@ -37,35 +37,6 @@ public protocol DynamicObject: class {
func cs_toRaw() -> NSManagedObject
}
public extension DynamicObject where Self: CoreStoreObject {
@inline(__always)
public static func keyPath<O: CoreStoreObject, V: ImportableAttributeType>(_ attribute: (Self) -> ValueContainer<O>.Required<V>) -> String {
return attribute(self.meta).keyPath
}
@inline(__always)
public static func keyPath<O: CoreStoreObject, V: ImportableAttributeType>(_ attribute: (Self) -> ValueContainer<O>.Optional<V>) -> String {
return attribute(self.meta).keyPath
}
@inline(__always)
public static func `where`(_ condition: (Self) -> Where) -> Where {
return condition(self.meta)
}
// MARK: Internal
internal static var meta: Self {
return self.init(asMeta: ())
}
}
// MARK: - NSManagedObject
@@ -127,3 +98,14 @@ extension CoreStoreObject {
return self.rawObject!
}
}
// MARK: - Internal
internal extension DynamicObject where Self: CoreStoreObject {
internal static var meta: Self {
return self.init(asMeta: ())
}
}