prorm API Reference
    Preparing search index...

    Class DECIMAL

    Base class for all data types

    Hierarchy (View Summary)

    Index
    • Create a DECIMAL data type

      Parameters

      • OptionalprecisionOrOptions: number | { precision?: number; scale?: number; unsigned?: boolean }

        Either precision number or an options object

      • scale: number = 0

        Number of decimal places (when precision is a number)

      • unsigned: boolean = false

        Whether the value is unsigned

      Returns DECIMAL

      // DECIMAL with default precision (10, 0)
      DataTypes.DECIMAL()
      // DECIMAL with precision only (scale defaults to 0)
      DataTypes.DECIMAL(10)
      // DECIMAL with precision and scale
      DataTypes.DECIMAL(10, 2)
      // DECIMAL with options object
      DataTypes.DECIMAL({ precision: 10, scale: 2, unsigned: true })
    key: "DECIMAL" = ...
    precision: number

    Total number of digits (precision)

    scale: number

    Number of digits after the decimal point (scale)

    unsigned?: boolean

    Whether the value is unsigned (MySQL/MariaDB only)

    • Serialize a value for storage based on this DataType

      Parameters

      • value: unknown

        The value to serialize

      Returns unknown

      The serialized value