sql-adaptor

1.1.0 • Public • Published

sql-adaptor-js

This is a repository that packages and exposes SQL functions necessary as a platform library

All basic SQL functions are exposed in lib/index.js

Testing

  1. Start a SQL instance. ./startSQL.sh
  2. Copy config-example.yaml to config-local.yaml
  3. Run tests! npm test

Escaping

We've added a friendly escaping system! It can be used like so:

SQL.query(`
  INSERT INTO items (type, count)
  VALUES ($0, $1);
`, ['drug', 15])

This will insert { type: 'drug', count: 15 }.

Be sure to escape all values which may change in queries using this method! :)

Troubleshooting

To create a table the library accepts a JSON object with the key as the name of the field and the value as all other options that SQL accepts such as type, KEY, auto-increment etc. If there are multiple options it must be formatted correctly with spaces in between them and be in a single string.

To use this library you will need permissions to use Chronicled private npm registry. Once you have the credentials/token,

  • npm install @chronicled/sql-adaptor-js
  • require('@chronicled/sql-adaptor-js') in your application

Readme

Keywords

none

Package Sidebar

Install

npm i sql-adaptor

Weekly Downloads

0

Version

1.1.0

License

ISC

Unpacked Size

6.2 kB

Total Files

7

Last publish

Collaborators

  • chronicled