PGlite Dialect for Kysely
npm install kysely-pglite-dialect


Lightweight Kysely dialect for PGlite with zero dependencies.
Note, since PGlite is single user and only supports a single connection this library serializes multiple connections,
i.e. acquiring a new connection will block till a previous connection is released.
While this avoids multiple transactions from concurrently using (and messing up) the single PGlite connection, it can also lead to deadlocks that wouldn't occur on a normal Postgres instance.
However, for the most common use-cases PGlite just works fine.
``bash`
npm i kysely-pglite-dialect kysely @electric-sql/pglite
Init Kysely like:
`typescript
import { Kysely } from "kysely"
import { PGlite } from "@electric-sql/pglite"
import { PGliteDialect } from "kysely-pglite-dialect"
const db = new Kysely<{
pglite_test_table: { id: Generated
}>({
dialect: new PGliteDialect(new PGlite()),
})
``
Thanks to kysely-neon which was used as a template for this repo.