monolayer-pg / schema / boolean
Function: boolean()
boolean():
PgBoolean
Column that stores booleans.
Returns
Remarks
Can have several states: "true", "false", or "unknown" (represented by null).
Kysely database schema type definition
ts
type Boolish = "true" | "false" | "yes" | "no" | 1 | 0 | "1" | "0" | "on" | "off";
{
readonly __select__: boolean | null;
readonly __insert__: boolean | Boolish | null | undefined;
readonly __update__: boolean | Boolish | null;
};
Nullability and optionality will change according to the column's constraints, generated values, and default data values.
Example
ts
import { boolean, schema, table } from "@monolayer/pg/schema";
const dbSchema = schema({
tables: {
example: table({
columns: {
active: boolean(),
},
}),
},
});
// Kysely database schema type type DB = typeof dbSchema.infer;
See
PostgreSQL native data type: boolean