Deprecation of legacy ValueContainer and RelationshipContainer properties in favor of @Field propertyWrapper counterpart

This commit is contained in:
John Estropia
2024-01-28 22:11:21 +09:00
parent 4b6d9a54e7
commit 7c2129e38f
38 changed files with 936 additions and 2861 deletions

View File

@@ -88,12 +88,6 @@ extension Where {
self.cs_keyPathString = component1 + "." + component2
}
// MARK: Deprecated
@available(*, deprecated, renamed: "O")
public typealias D = O
}
@@ -234,20 +228,6 @@ public func ~ <O: CoreStoreObject, D: FieldRelationshipToOneType, K: KeyPathStri
)
}
/**
Connects multiple `KeyPathStringConvertible`s to create a type-safe chain usable in query/fetch expressions
```
let owner = dataStack.fetchOne(From<Pet>().where((\.master ~ \.name) == "John"))
```
*/
public func ~ <O: CoreStoreObject, D: CoreStoreObject, K: KeyPathStringConvertible>(_ lhs: KeyPath<O, RelationshipContainer<O>.ToOne<D>>, _ rhs: KeyPath<D, K>) -> Where<O>.Expression<Where<O>.SingleTarget, K.DestinationValueType> where K.ObjectType == D {
return .init(
O.meta[keyPath: lhs].cs_keyPathString,
D.meta[keyPath: rhs].cs_keyPathString
)
}
/**
Connects multiple `KeyPathStringConvertible`s to create a type-safe chain usable in query/fetch expressions
```
@@ -290,20 +270,6 @@ public func ~ <O: CoreStoreObject, D: FieldRelationshipToOneType, K: ToManyRelat
)
}
/**
Connects multiple `KeyPathStringConvertible`s to create a type-safe chain usable in query/fetch expressions
```
let happyPets = dataStack.fetchAll(From<Pet>().where((\.master ~ \.pets).count() > 1))
```
*/
public func ~ <O: CoreStoreObject, D: CoreStoreObject, K: ToManyRelationshipKeyPathStringConvertible>(_ lhs: KeyPath<O, RelationshipContainer<O>.ToOne<D>>, _ rhs: KeyPath<D, K>) -> Where<O>.Expression<Where<O>.CollectionTarget, K.DestinationValueType> where K.ObjectType == D {
return .init(
O.meta[keyPath: lhs].cs_keyPathString,
D.meta[keyPath: rhs].cs_keyPathString
)
}
/**
Connects multiple `KeyPathStringConvertible`s to create a type-safe chain usable in query/fetch expressions
```
@@ -714,3 +680,28 @@ extension Where {
}
}
}
// MARK: - Deprecated
@available(*, deprecated, message: """
Legacy `Value.*`, `Transformable.*`, and `Relationship.*` declarations will soon be obsoleted. Please migrate your models and stores to new models that use `@Field.*` property wrappers. See: https://github.com/JohnEstropia/CoreStore?tab=readme-ov-file#new-field-property-wrapper-syntax
""")
public func ~ <O: CoreStoreObject, D: CoreStoreObject, K: KeyPathStringConvertible>(_ lhs: KeyPath<O, RelationshipContainer<O>.ToOne<D>>, _ rhs: KeyPath<D, K>) -> Where<O>.Expression<Where<O>.SingleTarget, K.DestinationValueType> where K.ObjectType == D {
return .init(
O.meta[keyPath: lhs].cs_keyPathString,
D.meta[keyPath: rhs].cs_keyPathString
)
}
@available(*, deprecated, message: """
Legacy `Value.*`, `Transformable.*`, and `Relationship.*` declarations will soon be obsoleted. Please migrate your models and stores to new models that use `@Field.*` property wrappers. See: https://github.com/JohnEstropia/CoreStore?tab=readme-ov-file#new-field-property-wrapper-syntax
""")
public func ~ <O: CoreStoreObject, D: CoreStoreObject, K: ToManyRelationshipKeyPathStringConvertible>(_ lhs: KeyPath<O, RelationshipContainer<O>.ToOne<D>>, _ rhs: KeyPath<D, K>) -> Where<O>.Expression<Where<O>.CollectionTarget, K.DestinationValueType> where K.ObjectType == D {
return .init(
O.meta[keyPath: lhs].cs_keyPathString,
D.meta[keyPath: rhs].cs_keyPathString
)
}