Type Alias Selectable<Q, S>
Selectable: S extends NoTable
? KSelectable<Q>
: Q extends Kysely<infer DB>
? S extends keyof DB ? KSelectable<DB[S]> : never
: S extends keyof Q ? KSelectable<Q[S]> : never
? KSelectable<Q>
: Q extends Kysely<infer DB>
? S extends keyof DB ? KSelectable<DB[S]> : never
: S extends keyof Q ? KSelectable<Q[S]> : never
Type Parameters
Example
// The following three types all describe the data returned from SELECT * FROM wrd.entities:
type WRDEntitiesSelect = Selectable<PlatformDB, "wrd.entities">;
const mydb = db<PlatformDB>();
type WRDEntitiesSelect2 = Selectable<typeof mydb, "wrd.entities">;
type WRDEntitiesSelect3 = Selectable<PlatformDB["wrd.entities"]>;
const rows: WRDEntitiesUpdate[] = await db<PlatformDB>().selectFrom("wrd.entities").selectAll().execute();
Converts a table of a Kysely database definition to the type of the data returned by SELECT queries.