nano-sqlite
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

Nano-SQLite3

SQLite3 Driver for Nano SQL

nanoSQL Logo

NPM

Documentation

Installation

npm i --save nano-sqlite

Usage

import { nSQL } from "nano-sql";
import { nSQLiteAdapter, sqlite3 } from "nano-sqlite";
 
nSQL("table")
.model([...])
.config({
    mode: new nSQLiteAdapter(":memory:", sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE),
    ...other config options
}).connect()...

That's it, now everything NanoSQL can do you can do with SQLite.

Read about NanoSQL here.

API

When you call new nSQLiteAdapter the arguments are exactly the same as for node-sqlite.

The first argument is optional, it's the name of the SQLite database to create. Leaving the argument empty is the same as passing in ":memory:", which will cause the SQLite database to operate in memory only mode. Passing in a string will cause it to make a database and use that as it's name.

The second argument is optional, One or more of sqlite3.OPEN_READONLY, sqlite3.OPEN_READWRITE and sqlite3.OPEN_CREATE. The default value is OPEN_READWRITE | OPEN_CREATE.

When using this adapter the id you pass into the config object will be ignored.

Package Sidebar

Install

npm i nano-sqlite

Homepage

nanosql.io/

Weekly Downloads

14

Version

1.7.0

License

MIT

Unpacked Size

26.4 kB

Total Files

8

Last publish

Collaborators

  • clicksimply