diff --git a/Sources/From+Querying.swift b/Sources/From+Querying.swift index fcad4f5..056094e 100644 --- a/Sources/From+Querying.swift +++ b/Sources/From+Querying.swift @@ -65,6 +65,17 @@ public extension From { return self.fetchChain(appending: Where(format, argumentArray: argumentArray)) } + + /** + Creates a `FetchChainBuilder` that starts with the specified `OrderBy` clause. + + - parameter clause: the `OrderBy` clause to create a `FetchChainBuilder` with + - returns: a `FetchChainBuilder` that starts with the specified `OrderBy` clause + */ + public func orderBy(_ clause: OrderBy) -> FetchChainBuilder { + + return self.fetchChain(appending: clause) + } /** Creates a `FetchChainBuilder` with a series of `SortKey`s @@ -77,6 +88,17 @@ public extension From { return self.fetchChain(appending: OrderBy([sortKey] + sortKeys)) } + + /** + Creates a `FetchChainBuilder` with a series of `SortKey`s + + - parameter sortKeys: a series of `SortKey`s + - returns: a `FetchChainBuilder` with a series of `SortKey`s + */ + public func orderBy(_ sortKeys: [OrderBy.SortKey]) -> FetchChainBuilder { + + return self.fetchChain(appending: OrderBy(sortKeys)) + } /** Creates a `FetchChainBuilder` with a closure where the `NSFetchRequest` may be configured @@ -467,6 +489,17 @@ public extension FetchChainBuilder { return self.fetchChain(appending: Where(format, argumentArray: argumentArray)) } + + /** + Adds an `OrderBy` clause to the `FetchChainBuilder` + + - parameter clause: the `OrderBy` clause to add + - returns: a new `FetchChainBuilder` containing the `OrderBy` clause + */ + public func orderBy(_ clause: OrderBy) -> FetchChainBuilder { + + return self.fetchChain(appending: clause) + } /** Adds an `OrderBy` clause to the `FetchChainBuilder` @@ -479,6 +512,17 @@ public extension FetchChainBuilder { return self.fetchChain(appending: OrderBy([sortKey] + sortKeys)) } + + /** + Adds an `OrderBy` clause to the `FetchChainBuilder` + + - parameter sortKeys: a series of `SortKey`s + - returns: a new `FetchChainBuilder` containing the `OrderBy` clause + */ + public func orderBy(_ sortKeys: [OrderBy.SortKey]) -> FetchChainBuilder { + + return self.fetchChain(appending: OrderBy(sortKeys)) + } /** Adds a `Tweak` clause to the `FetchChainBuilder` with a closure where the `NSFetchRequest` may be configured @@ -583,6 +627,17 @@ public extension QueryChainBuilder { return self.queryChain(appending: Where(format, argumentArray: argumentArray)) } + + /** + Adds an `OrderBy` clause to the `QueryChainBuilder` + + - parameter clause: the `OrderBy` clause to add + - returns: a new `QueryChainBuilder` containing the `OrderBy` clause + */ + public func orderBy(_ clause: OrderBy) -> QueryChainBuilder { + + return self.queryChain(appending: clause) + } /** Adds an `OrderBy` clause to the `QueryChainBuilder` @@ -595,6 +650,17 @@ public extension QueryChainBuilder { return self.queryChain(appending: OrderBy([sortKey] + sortKeys)) } + + /** + Adds an `OrderBy` clause to the `QueryChainBuild` + + - parameter sortKeys: a series of `SortKey`s + - returns: a new `QueryChainBuilder` containing the `OrderBy` clause + */ + public func orderBy(_ sortKeys: [OrderBy.SortKey]) -> QueryChainBuilder { + + return self.queryChain(appending: OrderBy(sortKeys)) + } /** Adds a `Tweak` clause to the `QueryChainBuilder` with a closure where the `NSFetchRequest` may be configured @@ -803,6 +869,17 @@ public extension SectionMonitorChainBuilder { return self.sectionMonitorChain(appending: Where(format, argumentArray: argumentArray)) } + + /** + Adds an `OrderBy` clause to the `SectionMonitorChainBuilder` + + - parameter clause: the `OrderBy` clause to add + - returns: a new `SectionMonitorChainBuilder` containing the `OrderBy` clause + */ + public func orderBy(_ clause: OrderBy) -> SectionMonitorChainBuilder { + + return self.sectionMonitorChain(appending: clause) + } /** Adds an `OrderBy` clause to the `SectionMonitorChainBuilder` @@ -815,6 +892,17 @@ public extension SectionMonitorChainBuilder { return self.sectionMonitorChain(appending: OrderBy([sortKey] + sortKeys)) } + + /** + Adds an `OrderBy` clause to the `SectionMonitorChainBuilder` + + - parameter sortKeys: a series of `SortKey`s + - returns: a new `SectionMonitorChainBuilder` containing the `OrderBy` clause + */ + public func orderBy(_ sortKeys: [OrderBy.SortKey]) -> SectionMonitorChainBuilder { + + return self.sectionMonitorChain(appending: OrderBy(sortKeys)) + } /** Adds a `Tweak` clause to the `SectionMonitorChainBuilder` with a closure where the `NSFetchRequest` may be configured