mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-16 05:56:50 +01:00
add OrderBy utilities for Field.Stored
This commit is contained in:
@@ -185,6 +185,14 @@ public struct OrderBy<O: DynamicObject>: OrderByClause, FetchClause, QueryClause
|
||||
|
||||
|
||||
// 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
|
||||
@@ -217,6 +225,14 @@ public struct OrderBy<O: DynamicObject>: OrderByClause, FetchClause, QueryClause
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user