Skip to content

idColumnSqlite

idColumnSqlite<Brand>(codec): SQLiteCustomColumnBuilder<{ columnType: "SQLiteCustomColumn"; data: Id<Brand>; dataType: "custom"; driverParam: string; enumValues: undefined; name: ""; }>

Defined in: src/adapters/drizzle.ts:166

Drizzle custom column type that stores an Id<Brand> as a canonical text value in SQLite.

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(), not strict is(). Throws IdsError("invalid_id") if the value from the database does not parse as a valid Id<Brand>.

Brand extends string

IdColumnCodec<Brand>

SQLiteCustomColumnBuilder<{ columnType: "SQLiteCustomColumn"; data: Id<Brand>; dataType: "custom"; driverParam: string; enumValues: undefined; name: ""; }>

import { idColumnSqlite } from "@smonn/ids/drizzle";
import { createTimestampId } from "@smonn/ids";
const usr = createTimestampId("usr");
export const users = sqliteTable("users", { id: idColumnSqlite(usr).primaryKey() });
// users.id is Id<"usr"> end-to-end