qsql
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Attention: not for a usage in current status. In deep development! Please, don't install it for now. Wait for the future versions.

An Express middleware to convert query parameters to SQL query.

Features

  • Provide a simple language on-top of url query parameters format to constructing SQL queries.
  • Automatically construct knex builder object based on query parameters.
  • Provide ability to get raw SQL query as string or with bindings to use anywhere.

Install

npm i qsql --save

Usage

Configuration

const qsql = require('qsql');
const express = require('express');

const app = express();

app.use(qsql({
    client: 'pg'
}));

app.get('/products', (req, res, next) => {
    // req.qsql - ready to use `knex` builder
    // use req.qsql.toString() to get SQL query as string
    // use req.qsql.toSQL() to get SQL query with bindings
});

app.listen(process.env.PORT);

Readme

Keywords

none

Package Sidebar

Install

npm i qsql

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

1.29 kB

Total Files

4

Last publish

Collaborators

  • paulmaly