JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20161
  • Score
    100M100P100Q163825F
  • License MIT

Generate SQL queries from Waterline statements.

Package Exports

  • waterline-sql-builder

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (waterline-sql-builder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Waterline SQL Builder

Build Status

A helper for building SQL queries from Waterline statements based on Knex.

This is a replacement for the Waterline-Sequel package in newer specs of the Waterline adapter interface. It is not backwards compatible.

Behind the scenes Knex is used to generate queries which should be valid in any of the databases they support. The official SQL adapters will use this library internally.

Refer to Waterline Query Docs for more information on Waterline Statements.

How To Use

This module is meant to be used by adapter authors who need to generate a query to run on a given driver. Example usage is below:

var sqlBuilder = require('waterline-sql-builder')({
  dialect: 'postgres'
});

var sql = sqlBuilder.generate({
  select: ['id'],
  where: {
    firstName: 'Test',
    lastName: 'User'
  },
  from: 'users'
});
{
  sql: 'select "id" from "users" where "firstName" = $1 and "lastName" = $2',
  bindings: ['Test', 'User']
}