coral-sql

1.3.0 • Public • Published

coral-sql

npm version CI

The nodejs module for building SQL by complec and related like coral.

Installation

> npm install coral-sql
> yarn add coral-sql

Usage

import { createBuilder } from 'coral-sql'

const [sql, bindings] = createBuilder()
  .columns('age')
  .columns(unescape('COUNT(*)'), 'value')
  .from('users')
  .where('enabled', true)
  .groupBy('age')
  .having('value', '>=', 10)
  .orderBy('value', 'desc')
  .toSQL()

const query = await connection.query(sql, bindings)
// SELECT `age`, COUNT(*) AS `value` FROM `users` WHERE `enabled` = ? GROUP BY `age` HAVING `value` >= ? ORDER BY `value` DESC
// [1, 10]

Documentation

Document is here.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.3.0164latest

Version History

VersionDownloads (Last 7 Days)Published
1.3.0164
1.2.0111
1.1.269
1.1.076
1.0.338
1.0.13
1.0.02
0.0.3-316
0.0.3-20
0.0.3-10
0.0.3-00
0.0.2-100
0.0.2-91
0.0.2-81
0.0.2-60
0.0.2-20
0.0.1-01
0.0.00

Package Sidebar

Install

npm i coral-sql

Weekly Downloads

482

Version

1.3.0

License

MIT

Unpacked Size

122 kB

Total Files

9

Last publish

Collaborators

  • mizuki_r