Skip to content

monolayer-pg / schema / doublePrecision

Function: doublePrecision()

doublePrecision(): PgDoublePrecision

Column that stores inexact, variable-precision numeric types.

Returns

PgDoublePrecision

Remarks

Range: around 1E-307 to 1E+308 with a precision of at least 15 digits.

Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and retrieving a value might show slight discrepancies.

It also accepts have several special values:

  • Infinity
  • -Infinity
  • NaN

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.

Example

ts
import { doublePrecision, schema, table } from "@monolayer/pg/schema";

const dbSchema = schema({
  tables: {
    example: table({
      columns: {
        value: doublePrecision(),
      },
    }),
  },
});

// Kysely database schema type
type DB = typeof dbSchema.infer;

See

PostgreSQL Docs: double precision