knex-pglite
TypeScript icon, indicating that this package has built-in type declarations

0.9.7 • Public • Published

knex-pglite

NPM Version CI

PGlite Dialect for knex.js

Since PGlite is single user and only supports a single connection, this library doesn't allow users to configure the connection pool in the Knex.Config. Internally, the pool is set to { min: 1, max: 1 }, i.e. there is exactly one connection at a time.

Install

npm install knex-pglite

Usage

import { knex } from "knex";
import ClientPgLite from "knex-pglite";

const instance = knex({
  client: ClientPgLite,
  dialect: "postgres",
  // Use an empty object to use an in memory db
  connection: {},
  // OR provide own PGLite instance
  // connection: { pglite: new PGLite() },
  // OR use the filesystem:
  // connection: { filename: 'path/to/my-pgdata' },
  // OR use indexdb:
  // connection: { connectionString: 'idb://my-pgdata' },
});

Acknowledgements

Mostly based on the build-in knex Postgres/Sqlite dialects.

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i knex-pglite

Weekly Downloads

8

Version

0.9.7

License

MIT

Unpacked Size

18.2 kB

Total Files

12

Last publish

Collaborators

  • clemens-zeidler