Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/kysely_postgrs_js_dialect/deps.ts>Kysely#withTables

Kysely dialect for PostgreSQL using the Postgres.js client.
Latest
method Kysely.prototype.withTables
Re-export
import { Kysely } from "https://deno.land/x/kysely_postgrs_js_dialect@v0.27.4/deps.ts";

Returns a copy of this Kysely instance with tables added to its database type.

This method only modifies the types and doesn't affect any of the executed queries in any way.

Examples

The following example adds and uses a temporary table:

Examples

Example 1

await db.schema
  .createTable('temp_table')
  .temporary()
  .addColumn('some_column', 'integer')
  .execute()

const tempDb = db.withTables<{
  temp_table: {
    some_column: number
  }
}>()

await tempDb
  .insertInto('temp_table')
  .values({ some_column: 100 })
  .execute()

Type Parameters

T extends Record<string, Record<string, any>>

Returns

Kysely<DrainOuterGeneric<DB & T>>