Giter Site home page Giter Site logo

querybuilder's People

Contributors

augustoccesar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

querybuilder's Issues

Write examples of usage

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.

Ways to create Condition

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)

Select multiple fields for same table

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 new README.md

Create a new README.md with the description of created functions until 2.1.0 , installation guide and license.

Ways to create Order

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");

Define limit to the query

SelectBuilder should contain a method to limit the result size

new SelectBuilder().limit(10) // Limit the query results to 10

Replace Column custom .build(boolean, boolean)

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()

Unit Tests

Create unit tests for existing classes

Column markdown

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

Table markdown

A queried Table can be defined as:

Markdown String => GENERATES => Formatted String for Query
users{u} => users u

Union all

I would like to see the possibility to have union all in query builder. Union all with pagination. Is it possible? Thanks in advance.

Union and Union All

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);

Modularize Database Support

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

Select without table alias

In Android Sqlite we doesn't need the table alias in the select ".select("i.name")".
Fix it ASAP, thanks

Aggregation and Group By

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);

Kotlin code

Rewrite the project using kotlin, both for study propose and for better code.

Ways to create Join

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" )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.