From 5ede276035ef01d5e3901fe36c45d1bd05efbf8b Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 4 Apr 2016 11:37:24 -0400 Subject: [PATCH] Fixes #20: Add groupBy methods to QueryWhere --- releases.moxie | 3 +- src/main/java/com/iciql/QueryWhere.java | 95 +++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/releases.moxie b/releases.moxie index 65bb945..4413564 100644 --- a/releases.moxie +++ b/releases.moxie @@ -11,7 +11,8 @@ r30: { security: ~ fixes: ~ changes: ~ - additions: ~ + additions: + - Added groupBy methods to QueryWhere dependencyChanges: ~ contributors: ~ } diff --git a/src/main/java/com/iciql/QueryWhere.java b/src/main/java/com/iciql/QueryWhere.java index 731fc0b..fdce1cb 100644 --- a/src/main/java/com/iciql/QueryWhere.java +++ b/src/main/java/com/iciql/QueryWhere.java @@ -532,6 +532,101 @@ public class QueryWhere { return this; } + /** + * Group by primitive boolean field + * + * @param field + * a primitive boolean field + * @return the query + */ + public QueryWhere groupBy(boolean field) { + query.getFrom().getAliasDefinition().checkMultipleBooleans(); + return groupByPrimitive(field); + } + + /** + * Group by primitive byte field + * + * @param field + * a primitive byte field + * @return the query + */ + public QueryWhere groupBy(byte field) { + return groupByPrimitive(field); + } + + /** + * Group by primitive short field + * + * @param field + * a primitive short field + * @return the query + */ + public QueryWhere groupBy(short field) { + return groupByPrimitive(field); + } + + public QueryWhere groupBy(int field) { + return groupByPrimitive(field); + } + + /** + * Group by primitive long field + * + * @param field + * a primitive long field + * @return the query + */ + public QueryWhere groupBy(long field) { + return groupByPrimitive(field); + } + + /** + * Group by primitive float field + * + * @param field + * a primitive float field + * @return the query + */ + public QueryWhere groupBy(float field) { + return groupByPrimitive(field); + } + + /** + * Group by primitive double field + * + * @param field + * a primitive double field + * @return the query + */ + public QueryWhere groupBy(double field) { + return groupByPrimitive(field); + } + + private QueryWhere groupByPrimitive(Object field) { + query.groupByPrimitive(field); + return this; + } + + public QueryWhere groupBy(Object field) { + query.getFrom().getAliasDefinition().checkMultipleEnums(field); + query.groupBy(field); + return this; + } + + /** + * Group by a number of Object columns. + * + * @param expressions + * the group by expressions + * @return the query + */ + + public QueryWhere groupBy(Object... expressions) { + query.groupBy(expressions); + return this; + } + public int delete() { return query.delete(); } -- 2.39.5