Skip to content

Commit 6d9fb5c

Browse files
committed
Remove private group() function
It's used as a funnel and shouldn't be called directly. After all, `having: nil` makes no sense. Signed-off-by: Stephen Celis <stephen@stephencelis.com>
1 parent 6bc2aed commit 6d9fb5c

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

SQLite/Query.swift

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,25 +218,18 @@ public struct Query {
218218
/// :param: having A condition determining which groups are returned.
219219
///
220220
/// :returns: A query with the given GROUP BY clause applied.
221-
public func group(by: [Expressible], having: Expression<Bool>? = nil) -> Query {
221+
public func group(by: [Expressible], having: Expression<Bool?>) -> Query {
222+
return group(by, having: Expression<Bool>(having))
223+
}
224+
225+
private func group(by: [Expressible], having: Expression<Bool>? = nil) -> Query {
222226
var query = self
223227
var group = Expression<Void>.join(" ", [Expression<Void>(literal: "GROUP BY"), Expression<Void>.join(", ", by)])
224228
if let having = having { group = Expression<Void>.join(" ", [group, Expression<Void>(literal: "HAVING"), having]) }
225229
query.group = group
226230
return query
227231
}
228232

229-
/// Sets a GROUP BY-HAVING clause on the query.
230-
///
231-
/// :param: by A list of columns to group by.
232-
///
233-
/// :param: having A condition determining which groups are returned.
234-
///
235-
/// :returns: A query with the given GROUP BY clause applied.
236-
public func group(by: [Expressible], having: Expression<Bool?>) -> Query {
237-
return group(by, having: Expression<Bool>(having))
238-
}
239-
240233
/// Sets an ORDER BY clause on the query.
241234
///
242235
/// :param: by An ordered list of columns and directions to sort by.

0 commit comments

Comments
 (0)