1.0.1 • Published 6 months ago

coral-sql v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

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.

1.0.1

6 months ago

1.0.0

6 months ago

0.0.3-1

4 years ago

0.0.3-0

4 years ago

0.0.3-3

4 years ago

0.0.3-2

4 years ago

0.0.2-10

4 years ago

0.0.2-9

4 years ago

0.0.2-8

4 years ago

0.0.2-6

4 years ago

0.0.2-2

4 years ago

0.0.1-0

4 years ago

0.0.0

4 years ago