JSPM

  • Created
  • Published
  • Downloads 15621
  • Score
    100M100P100Q147286F

sql builder

Package Exports

  • sql
  • sql/lib/node
  • sql/lib/node/index
  • sql/lib/node/query
  • sql/lib/table

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 (sql) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-sql

sql string builder for node

m4j0r work in progress...view tests for more examples

examples

//require the module
var sql = require('sql');

//first we define our table
var user = sql.define({
  name: 'user',
  columns: ['id', 'email', 'lastLogin']
});

//now we make a query
var usersWhoLoggedInBeforeToday = user.select(user.id, user.email).from(user).where(user.lastLogin.lt(new Date()));
console.log(usersWhoLoggedInBeforeToday); 
// { text: 'SELECT user.'id', user.'email' FROM user WHERE user.'lastLogin' > $1', values: ['2011-01-1'] }