Skip to content

Commit

Permalink
websql: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
refractalize committed Mar 13, 2017
1 parent 3cfbd58 commit 5202d2d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A very lightweight **write only** Node.js ORM, with support for:
* MySQL
* Oracle DB
* Sqlite 3
* Browser Web SQL

## NPM

Expand All @@ -20,6 +21,8 @@ Then install a database driver, one of:
npm install oracledb
npm install sqlite3

There's no need to install a driver for Web SQL, sworm will pick it up from the `window` object.

See [sworm](https://www.npmjs.org/package/sworm) in NPM.

## Write Only?
Expand Down Expand Up @@ -158,7 +161,7 @@ sworm.db(url)

* `url`, see urls for databases in respective section below

* `options.driver`, one of `'mssql'`, `'mysql'`, `'pg'`, `'oracle'` or `'sqlite'`.
* `options.driver`, one of `'mssql'`, `'mysql'`, `'pg'`, `'oracle'`, `'sqlite'` or `'websql'`.
* `options.config` see configuration for databases in respective section below

* `url` a connection URL, the following are supported
Expand Down Expand Up @@ -301,6 +304,25 @@ sworm.db(url)
}
```

* **websql**

URL: `websql:///db-name` or `db-name`

```js
{
driver: 'websql',
config: {
name: 'db-name',
// the `openDatabase` function to connect to the DB, defaulting to `window.openDatabase`
openDatabase: window.openDatabase,
// dababase size, defaulting to 5M
size: 5 * 1024 * 1024
}
}
```

### Close

Close the connection after use:
Expand All @@ -326,6 +348,7 @@ There are various schemes you can use:
* `sworm:pg` exact query passed to postgres
* `sworm:oracle` exact query passed to oracle
* `sworm:sqlite` exact query passed to sqlite3
* `sworm:websql` exact query passed to websql

## Models

Expand Down

0 comments on commit 5202d2d

Please sign in to comment.