Skip to main content
Module

x/kysely_deno_postgres_dialect/mod.ts>kysely.DummyDriver

Kysely dialect for PostgreSQL using the deno-postgres client.
Go to Latest
class kysely.DummyDriver
implements Driver
import { kysely } from "https://deno.land/x/kysely_deno_postgres_dialect@v0.27.0/mod.ts";
const { DummyDriver } = kysely;

A driver that does absolutely nothing.

You can use this to create Kysely instances solely for building queries

Examples

This example creates a Kysely instance for building postgres queries:

const db = new Kysely<Database>({
  dialect: {
    createAdapter() {
      return new PostgresAdapter()
    },
    createDriver() {
      return new DummyDriver()
    },
    createIntrospector(db: Kysely<any>) {
      return new PostgresIntrospector(db)
    },
    createQueryCompiler() {
      return new PostgresQueryCompiler()
    },
  },
})

You can use it to build a query and compile it to SQL but trying to execute the query will throw an error.

const { sql } = db.selectFrom('person').selectAll().compile()
console.log(sql) // select * from "person"

Methods

Acquires a new connection from the pool.

beginTransaction(): Promise<void>

Begins a transaction.

commitTransaction(): Promise<void>

Commits a transaction.

destroy(): Promise<void>

Destroys the driver and releases all resources.

init(): Promise<void>

Initializes the driver.

After calling this method the driver should be usable and acquireConnection etc. methods should be callable.

releaseConnection(): Promise<void>

Releases a connection back to the pool.

rollbackTransaction(): Promise<void>

Rolls back a transaction.