Documentation
    Preparing search index...

    Range types are data types representing a range of values of some element type (called the range's subtype). Only available in Postgres. See the Postgres documentation for more details

    Fallback policy: If this type is not supported, an error will be raised.

    // A range of integers
    DataTypes.RANGE(DataTypes.INTEGER)
    // A range of bigints
    DataTypes.RANGE(DataTypes.BIGINT)
    // A range of decimals
    DataTypes.RANGE(DataTypes.DECIMAL)
    // A range of timestamps
    DataTypes.RANGE(DataTypes.DATE)
    // A range of dates
    DataTypes.RANGE(DataTypes.DATEONLY)

    Type Parameters

    Hierarchy (View Summary)

    Index
    options: { subtype: AbstractDataType<any> }
    usageContext: DataTypeUseContext | undefined

    Where this DataType is being used.

    • Override this method to emit an error or a warning if the Data Type, as it is configured, is not compatible with the current dialect.

      Parameters

      Returns void

    • Whether this DataType wishes to handle NULL values itself. This is almost exclusively used by JSON and JSONB which serialize null as the JSON string 'null'.

      Returns boolean

    • Returns a copy of this DataType, without usage context. Designed to re-use a DataType on another Model.

      Returns this

    • Called when a value is retrieved from the Database, and its DataType is specified. Used to normalize values from the database.

      Note: It is also possible to do an initial parsing of a Database value using AbstractDialect#registerDataTypeParser. That normalization uses the type ID from the database instead of a Sequelize Data Type to determine which parser to use, and is called before this method.

      Parameters

      • _value: unknown

        The value to parse.

      Returns unknown

    • Used to normalize a value when Model#set is called. That is, when a user sets a value on a Model instance.

      Parameters

      • value: unknown

      Returns unknown

    • Returns a SQL declaration of this data type. e.g. 'VARCHAR(255)', 'TEXT', etc…

      Returns string

    • Returns string

    • Checks whether the JS value is compatible with (or can be converted to) the SQL data type. Throws if that is not the case.

      Parameters

      • value: any

      Returns void

    • Returns string