augustoccesar / querybuilder Goto Github PK
View Code? Open in Web Editor NEWSimple helper for building queries using Java/Kotlin code.
Simple helper for building queries using Java/Kotlin code.
Write concise examples of usage for each function of the SelectBuilder
and for each separated objects like Condition
, Join
, etc.
It should be written in separated .md
files for each object, and one general .md
for full examples.
The Condition
object should be created as:
Condition.eq("{u}name", "Augusto")
Considering the possible comparisons:
Condition.EQUALS // Condition.eq(field, value)
Condition.DIFFERENT// Condition.neq(field, value)
Condition.IN // Conditon.in(field, listValue)
Condition.IS_NULL // Condition.isNull(field)
Condition.IS_NOT_NULL // Condition.isNotNull(field)
Condition.LIKE // Condition.like(field, value)
Condition.NOT_LIKE // Condition.nlike(field, value)
Condition.GREATER_THAN // Condition.gt(field, value)
Condition.GREATER_THAN_OR_EQUAL // Condition.gte(field, value)
Condition.LESS_THAN // Condition.lt(field, value)
Condition.LESS_OR_EQUAL // Condition.lte(field, value)
Create a way to select multiple fields for the same table to avoid something like:
.select("{u}name", "{u}age", "{u}username")
And be able to do something like:
.select(SameTableColumns.tableAlias("u").fields("name", "age", "username"))
Create a new README.md
with the description of created functions until 2.1.0
, installation guide and license.
There should be a way to define an order to the results of the SelectBuilder
new Order().by("{u}id", Order.DESC);
Order.orderBy("{u}id", Order.ASC);
Order.orderDesc("{u}id");
Order.orderAsc("{u}id");
SelectBuilder
should contain a method to limit the result size
new SelectBuilder().limit(10) // Limit the query results to 10
Replace the custom .build()
method existing for Column
for the new method .sqlColumnRepresentation
that build only the column prefix (if present) and name
column.build(false, false)
// Will become
column.sqlColumnRepresentation()
Create unit tests for existing classes
A queried Column
can be defined as:
Markdown String => GENERATES => Formatted String for Query
{u}name
=> u.name AS u_name
{u}name{custom_alias}
=> u.name AS custom_alias
{u}name{_}
=> u.name
{u}*name
=> DISTINCT u.name
Add method for creating FROM
clause on the SelectBuilder
new SelectBuilder().from("users u")
new SelectBuilder().from("users{u}")
Need to update the README with the new functions created on the 2.1.0 release.
A queried Table
can be defined as:
Markdown String => GENERATES => Formatted String for Query
users{u}
=> users u
I would like to see the possibility to have union all in query builder. Union all with pagination. Is it possible? Thanks in advance.
There should be a way to create a SelectBuilder
that combines multiple SelectBuilder
's and create a Union or Union All clause. Something like:
SelectBuilder sb1 = new SelectBuilder().select("{u}name").from("users{u}").where(Condition.eq("{u}name", "Augusto"));
SelectBuilder sb2 = new SelectBuilder().select("{u}name").from("users{u}").where(Condition.eq("{u}name", "Teste");
new SelectBuilder().union(sb1, sb2);
//OR
new SelectBuilder().unionAll(sb1, sb2);
Initially, QueryBuilder is built to support MySQL. But its support should be modularized to the user to be able to select which database is going to use the queries, and so developers can create modules for each database
In Android Sqlite we doesn't need the table alias in the select ".select("i.name")".
Fix it ASAP, thanks
Create a way to make group by aggregations on the SelectBuilder
with something like:
new SelectBuilder()
.select(Aggregation.count("{u}id"))
.groupBy("{u}city");
Or create it outside and append to SelectBuilder
.
Aggregation agg = Aggregation.count("{u}id").groupBy("{u}city");
new SelectBuilder()
.aggregation(agg);
Create JavaDoc for classes and methods
Add the possibility to change the alias pattern that, as defined now, if not set via markdown (#7 ) it will follow the patten <table alias>_<column name>
Rewrite the project using kotlin, both for study propose and for better code.
A Join
should be created in one of the many ways:
new Join(Join.LEFT).table("user_profile{up}").on("{u}id", "{up}user_id");
new Join(Join.LEFT).table("user_profile{up}").on("{u}id = {up}user_id");
new Join(Join.INNER, "user_profile{up}", "{u}id", "{up}user_id" )
new Join(Join.INNER, "user_profile{up}", "{u}id = {up}user_id" )
Create a basic documentation for using QueryBuilder with Kotlin.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.