knex-sqlite
v2.0.1
Published
Little wrapper library for creating an instance of knex for an sqlite3 database.
Downloads
10
Readme
Knex-Sqlite
Little wrapper library for creating an instance of knex for an sqlite3 database.
Usage
import knexSqlite, { OPEN_READONLY } from 'knex-sqlite';
const knex = knexSqlite(
// Required: the name of your databse
'./my-database.sqlite',
// Optional: the file open mode (defaults to read-write)
OPEN_READONLY,
// Optional: the knex constructor options
{
debug: true
}
);
console.log(await knex.select('*').from('blog_posts'));
Dependencies
- knex: ^2.0.0
- sqlite3: ^5.0.5
knex-sqlite
Knex Sqlite3
- knex-sqlite
- static
- .default ⇒ Knex
- .OPEN_READONLY : number
- .OPEN_READWRITE : number
- .OPEN_CREATE : number
- inner
- static
knex-sqlite.default ⇒ Knex
Return an instance of knex for an sqlite3 database. The filename and mode arguments are the same as those in the sqlite3 library
Kind: static property of knex-sqlite
Returns: Knex - Instance of knex library
See: node-sqlite3
| Param | Type | Description | | --- | --- | --- | | filename | string | The database to access | | mode | mode | The mode to open the database as | | options | object | Additional knex options |
knex-sqlite.OPEN_READONLY : number
Open file as read only
Kind: static typedef of knex-sqlite
knex-sqlite.OPEN_READWRITE : number
Open file as read-write
Kind: static typedef of knex-sqlite
knex-sqlite.OPEN_CREATE : number
Create the file
Kind: static typedef of knex-sqlite
knex-sqlite~mode : OPEN_READONLY | OPEN_READWRITE | OPEN_CREATE
Modes for opening the database with
Kind: inner typedef of knex-sqlite
See: node-sqlite3
knex-sqlite~Knex
Knex instance
Kind: inner external of knex-sqlite
See: Knex