Builds sql query for RDBMS


030.0.65 years ago5 years agoMinified + gzip package size for @iamthes/query-builder in KB


Query Builder

Builds sql query for RDBMS.


npm i -S @iamthes/query-builder


const queryBuilder = require("@iamthes/query-builder");
const q = queryBuilder.create("mysql");
var sql = q()
    .where("id", 5)
    .get(); // select * from user where id = 5
const queryBuilder = require("@iamthes/query-builder");
const Builder = queryBuilder.mysql;
const b = new Builder();
var sql = b
    .select("count", "*", "total")
    .get(); // select count(*) as total from user

// Using same instance to build next query.
sql = b
    .select("job, salary")
    .where("salary", "@null")
    .get(); // select job, salary from user where salary = null

Check test directory for more examples.


  • 0.0.6 (15 Aug 2016) export definition files, more typings
  • 0.0.3 (26 Jul 2016) where can accept 3 parameters
  • 0.0.2 (24 Jul 2016) second release
  • 0.0.1 (23 Jul 2016) first release

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.