mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-28 12:21:51 +01:00
add OrderBy utilities for Field.Stored
This commit is contained in:
@@ -186,6 +186,14 @@ public struct OrderBy<O: DynamicObject>: OrderByClause, FetchClause, QueryClause
|
|||||||
|
|
||||||
// MARK: CoreStoreObject Key Paths
|
// MARK: CoreStoreObject Key Paths
|
||||||
|
|
||||||
|
/**
|
||||||
|
Indicates that the `KeyPathString` should be sorted in ascending order
|
||||||
|
*/
|
||||||
|
public static func ascending<T>(_ attribute: KeyPath<O, FieldContainer<O>.Stored<T>>) -> SortKey {
|
||||||
|
|
||||||
|
return .ascending(O.meta[keyPath: attribute].keyPath)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Indicates that the `KeyPathString` should be sorted in ascending order
|
Indicates that the `KeyPathString` should be sorted in ascending order
|
||||||
*/
|
*/
|
||||||
@@ -218,6 +226,14 @@ public struct OrderBy<O: DynamicObject>: OrderByClause, FetchClause, QueryClause
|
|||||||
return .ascending(O.meta[keyPath: attribute].keyPath)
|
return .ascending(O.meta[keyPath: attribute].keyPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Indicates that the `KeyPathString` should be sorted in descending order
|
||||||
|
*/
|
||||||
|
public static func descending<T>(_ attribute: KeyPath<O, FieldContainer<O>.Stored<T>>) -> SortKey {
|
||||||
|
|
||||||
|
return .descending(O.meta[keyPath: attribute].keyPath)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Indicates that the `KeyPathString` should be sorted in descending order
|
Indicates that the `KeyPathString` should be sorted in descending order
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user