diff options
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | src/main/java/com/iciql/Query.java | 10 | ||||
-rw-r--r-- | src/test/java/com/iciql/test/ModelsTest.java | 8 |
3 files changed, 22 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ce2d54..03aaca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +### [2.1.1] - 2016-04-07 +#### Added +- Add explicit `where(String)` method to help with non-Java language interop + ### [2.1.0] - 2016-04-06 #### Added - Add methods to select counts of a group by field (*SELECT field, COUNT(*) FROM table [WHERE conditions] GROUP BY field*) diff --git a/src/main/java/com/iciql/Query.java b/src/main/java/com/iciql/Query.java index 20d5520..d1528e8 100644 --- a/src/main/java/com/iciql/Query.java +++ b/src/main/java/com/iciql/Query.java @@ -663,6 +663,16 @@ public class Query<T> { return new QueryWhere<T>(this); } + /** + * Begin an string field condition clause explicitly defined for interop clarity. + * + * @param x the mapped string to query + * @return a query condition to continue building the condition + */ + public QueryCondition<T, String> where(String x) { + return new QueryCondition<T, String>(this, x); + } + public QueryWhere<T> where(String fragment, List<?> args) { return this.where(fragment, args.toArray()); } diff --git a/src/test/java/com/iciql/test/ModelsTest.java b/src/test/java/com/iciql/test/ModelsTest.java index 96a6e4a..9fef979 100644 --- a/src/test/java/com/iciql/test/ModelsTest.java +++ b/src/test/java/com/iciql/test/ModelsTest.java @@ -218,4 +218,12 @@ public class ModelsTest { assertEquals("[Condiments=5, Beverages=2, Produce=1, Meat/Poultry=1]", categories.toString()); } + @Test + public void testWhereByString() { + Product products = new Product(); + + List<Product> seafoodProducts = db.from(products).where(products.category).is("Seafood").select(); + assertEquals(1, seafoodProducts.size()); + } + } |