import { type kysely } from "https://deno.land/x/kysely_postgrs_js_dialect@v0.27.4/mod.ts";
const { ColumnType } = kysely;
This type can be used to specify a different type for select, insert and update operations.
Also see the Generated type.
Examples
The next example defines a number column that is optional
in inserts and updates. All columns are always optional
in updates so therefore we don't need to specify undefined
for the update type. The type below is useful for all kinds of
database generated columns like identifiers. The Generated
type is actually just a shortcut for the type in this example:
ColumnType<number, number | undefined, number>
The above example makes the column optional in inserts
and updates, but you can still choose to provide the
column. If you want to prevent insertion/update you
can se the type as never
:
ColumnType<number, never, never>
Here's one more example where the type is different for each different operation:
ColumnType<Date, string, never>