1.0.0 • Published 10 years ago

koa-sql-insert v1.0.0

Weekly downloads
-
License
WTFPL
Repository
github
Last release
10 years ago

koa-sql-insert Build Status

Add query INSERT generator for KoaJS app

Setup

npm i -S koa-sql-insert

Usage

Generate SQL INSERT request

sqlInsert = require('koa-sql-insert');
app = koa();

app.use(sqlInsert);
app.use(function * () {
    var sqlString = this.sqlInsert
                    .reset()
                    .setTable('example')
                    .addField('id', 'int', 4)
                    .addField('name', 'string', 'titi', '')
                    .addReturning('id')
                    .getSql(); // INSERT INTO example (id, name) VALUES ('4', 'titi') RETURNING id;
});

Licence

WTFPL. Do what you want with this.

Thanks to

  • Companeo (@Companeo), which lets me create and publish this tool during my working time. They use it and hope you will use it too.
  • Benjamin (@benjaminW78), from Companeo, for his help and work during designing this tool.
1.0.0

10 years ago