variable col

Helper to create column definitions

Properties

boolean: (defaultValue: boolean) => ColumnDef<boolean>

Boolean column stored as INTEGER 0/1 in the database

converted: <App>(config: { default?: () => App; write: (v: App) => InValue; read: (raw: InValue) => App; }) => ColumnDef<App>

Column with type conversion between app and DB representations

encrypted: <T>(
encrypt: ColumnTransform<T>,
decrypt: ColumnTransform<T>
) => ColumnDef<T>

Column with read/write transforms (e.g., for encryption)

encryptedNullable: <T>(def: ColumnDef<T>) => ColumnDef<T | null>

Wrap an existing encrypted column def to pass through null values

encryptedText: (
encrypt: ColumnTransform<string>,
decrypt: ColumnTransform<string>
) => ColumnDef<string>

Encrypted text column with empty-string default

generated: <T>() => ColumnDef<T>

Auto-generated column (like id)

simple: <T>() => ColumnDef<T>

Simple column with no special handling

transform: <T>(
write: (v: T) => Promise<T> | T,
read: (v: T) => Promise<T> | T
) => ColumnDef<T>

Column with custom transforms

withDefault: <T>(defaultFn: () => T) => ColumnDef<T>

Column with default value