idColumn
idColumn<
Brand>(codec):object
Defined in: src/adapters/kysely.ts:90
Kysely column adapter bound to a codec.
Returns an object with fromDriver / toDriver helpers that mirror the read/write
contract of the Drizzle adapter — same error message, same strictness (safeParse on
read and write).
Write path: validates the value via codec.safeParse and throws
IdsError("invalid_id") if validation fails.
Read path: normalises the raw DB string via codec.safeParse(). Throws if
the value does not parse as a valid Id<Brand>.
Type Parameters
Section titled “Type Parameters”Brand extends string
Parameters
Section titled “Parameters”IdColumnCodec<Brand>
Returns
Section titled “Returns”object
fromDriver()
Section titled “fromDriver()”fromDriver(
value):Id<Brand>
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Id<Brand>
toDriver()
Section titled “toDriver()”toDriver(
value):string
Parameters
Section titled “Parameters”Id<Brand>
Returns
Section titled “Returns”string
Example
Section titled “Example”import { idColumn } from "@smonn/ids/kysely";import { createTimestampId } from "@smonn/ids";
const usr = createTimestampId("usr");const usrCol = idColumn(usr);
// In a query result handler:const id = usrCol.fromDriver(row.id);