summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2016-04-04 11:37:24 -0400
committerJames Moger <james.moger@gitblit.com>2016-04-04 11:37:24 -0400
commit5ede276035ef01d5e3901fe36c45d1bd05efbf8b (patch)
treea968fa0fe4489a84c1b05c61e074b543dcf8544a
parentf3f46f1dcd98e9c50e443f2daad42f08061ce668 (diff)
downloadiciql-5ede276035ef01d5e3901fe36c45d1bd05efbf8b.tar.gz
iciql-5ede276035ef01d5e3901fe36c45d1bd05efbf8b.zip
Fixes #20: Add groupBy methods to QueryWhere
-rw-r--r--releases.moxie3
-rw-r--r--src/main/java/com/iciql/QueryWhere.java95
2 files changed, 97 insertions, 1 deletions
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<T> {
return this;
}
+ /**
+ * Group by primitive boolean field
+ *
+ * @param field
+ * a primitive boolean field
+ * @return the query
+ */
+ public QueryWhere<T> 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<T> groupBy(byte field) {
+ return groupByPrimitive(field);
+ }
+
+ /**
+ * Group by primitive short field
+ *
+ * @param field
+ * a primitive short field
+ * @return the query
+ */
+ public QueryWhere<T> groupBy(short field) {
+ return groupByPrimitive(field);
+ }
+
+ public QueryWhere<T> groupBy(int field) {
+ return groupByPrimitive(field);
+ }
+
+ /**
+ * Group by primitive long field
+ *
+ * @param field
+ * a primitive long field
+ * @return the query
+ */
+ public QueryWhere<T> groupBy(long field) {
+ return groupByPrimitive(field);
+ }
+
+ /**
+ * Group by primitive float field
+ *
+ * @param field
+ * a primitive float field
+ * @return the query
+ */
+ public QueryWhere<T> groupBy(float field) {
+ return groupByPrimitive(field);
+ }
+
+ /**
+ * Group by primitive double field
+ *
+ * @param field
+ * a primitive double field
+ * @return the query
+ */
+ public QueryWhere<T> groupBy(double field) {
+ return groupByPrimitive(field);
+ }
+
+ private QueryWhere<T> groupByPrimitive(Object field) {
+ query.groupByPrimitive(field);
+ return this;
+ }
+
+ public QueryWhere<T> 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<T> groupBy(Object... expressions) {
+ query.groupBy(expressions);
+ return this;
+ }
+
public int delete() {
return query.delete();
}