knex-sqlite

2.0.1 • Public • Published

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.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

Package Sidebar

Install

npm i knex-sqlite

Weekly Downloads

1

Version

2.0.1

License

ISC

Unpacked Size

7.5 kB

Total Files

5

Last publish

Collaborators

  • paulkiddle