Skip to main content
Module

x/kysely_deno_postgres_dialect/mod.ts>kysely.AnyColumnWithTable

Kysely dialect for PostgreSQL using the deno-postgres client.
Latest
type alias kysely.AnyColumnWithTable
import { type kysely } from "https://deno.land/x/kysely_deno_postgres_dialect@v0.27.1/mod.ts";
const { AnyColumnWithTable } = kysely;

Given a database type and a union of table names in that db, returns a union type with all possible table.column combinations.

Example:

interface Person {
  id: number
}

interface Pet {
  name: string
  species: 'cat' | 'dog'
}

interface Movie {
  stars: number
}

interface Database {
  person: Person
  pet: Pet
  movie: Movie
}

type Columns = AnyColumnWithTable<Database, 'person' | 'pet'>

// Columns == 'person.id' | 'pet.name' | 'pet.species'

Type Parameters

DB
TB extends keyof DB
definition: [T in TB]: `${T & string}.${keyof DB[T] & string}`[TB]