Skip to content

Industrial/kysely-deno-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kysely Deno Postgres

Connector for Kysely with deno-postgres.

Usage

import {
  Kysely,
  PostgresAdapter,
  PostgresIntrospector,
  PostgresQueryCompiler,
} from "https://esm.sh/kysely";
import { PostgreSQLDriver } from "https://deno.land/x/kysely_deno_postgres/mod.ts";

const kysely = new Kysely({
  dialect: {
    createAdapter() {
      return new PostgresAdapter();
    },
    createDriver() {
      return new PostgreSQLDriver({
        // If connectionString is passed, other options are ignored.
        // connectionString: Deno.env.get('DATABASE_URL'),
        applicationName: "MyApp",
        connection: {
          attempts: 1,
        },
        database: "postgres",
        hostname: "localhost",
        host_type: "tcp", // "tcp" | "socket"
        password: "postgres",
        port: 5432,
        tls: {
          enabled: true,
          enforce: false,
          caCertificates: [],
        },
        user: "postgres",
      });
    },
    createIntrospector(db: Kysely<unknown>) {
      return new PostgresIntrospector(db);
    },
    createQueryCompiler() {
      return new PostgresQueryCompiler();
    },
  },
});

About

Connector for Kysely with deno-postgres.

Resources

License

Stars

Watchers

Forks

Packages

No packages published