sql-adaptor
v1.1.0
Published
This is a repository that packages and exposes sql functions necessary as a standalone library
Downloads
3
Readme
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
- Start a SQL instance.
./startSQL.sh
- Copy config-example.yaml to config-local.yaml
- 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