Skip to content

monolayer / schema / bigint

Function: bigint()

bigint(): PgBigInt

Column that stores whole numbers.

Returns

PgBigInt

Remarks

Range: -9223372036854775808 to +9223372036854775807.

Kysely database schema type definition

ts
{
  readonly __select__: string | null;
  readonly __insert__: bigint | number | string | null | undefined;
  readonly __update__: bigint | number | string | null;
};

Nullability and optionality will change according to the column's constraints, generated values, and default data values.

Zod Schema

Types:

ts
{
  input?: bigint | number | string | null | undefined;
  output?: string | null | undefined;
}

Nullability and optionality will change according to the column's constraints, generated values, and default data values.

Validations:

  • Explicit undefined values are rejected.
  • Value must be a valid bigint.
  • Value cannot be lower than -9223372036854775808.
  • Value cannot be greater than 9223372036854775807.

Example

ts
import { bigint, schema, table } from "monolayer/pg";
import { zodSchema } from "monolayer/zod";

const dbSchema = schema({
  tables: {
    example: table({
      columns: {
        id: bigint(),
      },
    }),
  },
});

// Kysely database schema type
type DB = typeof dbSchema.infer;
// Zod Schema
const schema = zodSchema(dbSchema.tables.example);

See

PostgreSQL Docs: bigint