/httpQL

A small library for converting URL query arguments into SQL queries.

Primary LanguageJavaApache License 2.0Apache-2.0

httpQL Documentation

httpQL is a small library for converting URL query arguments into SQL queries.

Given the following URL:

http://example.com/?name=bob&age__gt=20&order=-age

And an annotated POJO:

@QueryConstraints(defaultLimit = 10, maxLimit = 100, maxOffset = 100)
class Person {

   @FilterBy(Equal.class)
   String name;

   @FilterBy({Equal.class, GreaterThan.class})
   @OrderBy
   Integer age;

   // Getters/Setters elided
 }

httpQL will generate the query:

SELECT * FROM person
  WHERE (`name` = 'bob' AND `age` > 20)
  ORDER BY `age` DESC LIMIT 10 OFFSET 0;

Which you can then execute using your favorite driver, library, etc.

Sound cool? Get reading, then!

Class Loader StackOverflow Issue

  • Sometimes when including httpQL in your project you will run into intermittent issues where java.lang.ClassLoader.loadClass will throw a StackOverflow error. This is because your thread runs out of stack when trying to include all of the necessary classes. You can fix this by increasing your thread stack size with this deploy config option: JVM_STACK_SIZE: 384k. It is only recommended to do this if you run into this issue.