google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

Contribution: QueryBuilder #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I developed this to fill a need for a service which can submit multiple 
variations on a query. I've found Python code to do similar, simply using 
deepcopy, but the same is not available on GAE/J with Objectify.

I submit, QueryBuilder<T> free for any use (Apache2 License).

Very simple class which contains all parts of a query and can be used to 
produce new query instances. In addition it's serializable and overrides 
hashCode and equals so it can be safely used as a key in map, for example. 

Example usage:

QueryBuilder<Review> qb = QueryBuilder.of(Review.class)
  .ancestor(movie)
  .filter("rating >", 3)
  .limit(25)
  .offset(50)
  .orderBy("datePosted")
  .build(ObjectifyFactory.begin());

Original issue reported on code.google.com by mark.ren...@gmail.com on 3 Oct 2010 at 6:14

Attachments:

GoogleCodeExporter commented 9 years ago
I should add... 

The builder is mutable, but also provides a clone() method. I use this when 
supplying the builder to a complex operation. It first clone()'s the 
QueryBuilder so it can freely modify the parameters while doing it's work. In 
the course of it's operation it creates and executes several queries based on 
the original parameters. 

Original comment by mark.ren...@gmail.com on 3 Oct 2010 at 6:17

GoogleCodeExporter commented 9 years ago
Someone please take a look at this? It would be great to get this merged!

Original comment by mark.ren...@gmail.com on 9 Jan 2011 at 5:59

GoogleCodeExporter commented 9 years ago
I'll look into it after I finish the async stuff...

Original comment by lhori...@gmail.com on 11 Jan 2011 at 2:53

GoogleCodeExporter commented 9 years ago
Objectify's Query API changed significantly in v4. It now provides immutable 
objects which work very similar to this. Closing as Fixed. 

Original comment by lhori...@gmail.com on 14 Apr 2014 at 12:05