Connectors
SQLite
Connect DB0 to SQLite using better-sqlite3
Usage
For this connector, you need to install better-sqlite3
dependency:
npm i better-sqlite3
Use better-sqlite3
connector:
import { createDatabase } from "db0";
import sqlite from "db0/connectors/better-sqlite3";
const db = createDatabase(
sqlite({
name: ":memory:",
}),
);
Options
cwd
Working directory to create database. Default is current working directory of project. (It will be ignored if path
is provided an absolute path.)
name
Database (file) name. Default is db
.
You can use
:memory:
as name for in-memory storage.path
Related (to cwd
) or absolute path to the sql file. By default it is stored in {cwd}/.data/{name}.sqlite3
/ .data/db.sqlite3