New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding GROUP BY #15

Merged
merged 4 commits into from Mar 7, 2018

Conversation

2 participants
@rafiki270
Copy link
Contributor

rafiki270 commented Mar 6, 2018

As the Group by often requires some "deeper" calculations I have added an optional custom entry for it so you can do stuff like GROUP BY YEAR(date)

@rafiki270

This comment has been minimized.

Copy link
Contributor Author

rafiki270 commented Mar 6, 2018

ok, so multicolumn group by is possible

@@ -74,6 +77,19 @@ public enum OrderByDirection {
case descending
}

public struct DataGroupBy {
public var column: DataColumn?
public var custom: String?

This comment has been minimized.

@tanner0101

tanner0101 Mar 7, 2018

Member

I think this might make more sense as enum enum with two cases

This comment has been minimized.

@rafiki270

rafiki270 Mar 7, 2018

Author Contributor

agreed

This comment has been minimized.

@rafiki270

rafiki270 Mar 7, 2018

Author Contributor

done

@@ -0,0 +1,21 @@
extension SQLSerializer {
/// See SQLSerializer.serialize(groupBys:)
public func serialize(groupBys: [DataGroupBy]) -> String {

This comment has been minimized.

@tanner0101

tanner0101 Mar 7, 2018

Member

this signature needs to appear in the protocol decl as well so it can be overridden

This comment has been minimized.

@rafiki270

rafiki270 Mar 7, 2018

Author Contributor

done

@tanner0101 tanner0101 added this to the 1.0.0-rc.2 milestone Mar 7, 2018

@tanner0101 tanner0101 self-assigned this Mar 7, 2018

@tanner0101 tanner0101 merged commit 9535cd9 into vapor:master Mar 7, 2018

@rafiki270 rafiki270 deleted the rafiki270:group-by branch Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment