• Preparing search index...
  • The search index is not available
Documentation
  • Documentation
  • @sequelize/core
  • decorators-legacy
  • AllowNull

Function AllowNull

  • AllowNull(): PropertyOrGetterDescriptor
  • Makes the attribute accept null values. Opposite of NotNull. It is a shortcut for setting the allowNull option of the Attribute decorator to true.

    Returns PropertyOrGetterDescriptor

    Example

    class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
    @Attribute(DataTypes.STRING)
    @AllowNull
    declare firstName: string | null;
    }
    • Defined in packages/core/src/decorators/legacy/attribute.ts:129
  • AllowNull(options): PropertyOrGetterDescriptor
  • Makes the attribute accept null values. Opposite of NotNull. It is a shortcut for setting the allowNull option of the Attribute decorator to true.

    Parameters

    • options: boolean

    Returns PropertyOrGetterDescriptor

    Example

    class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
    @Attribute(DataTypes.STRING)
    @AllowNull
    declare firstName: string | null;
    }
    • Defined in packages/core/src/decorators/legacy/attribute.ts:129
  • AllowNull(target, propertyName, propertyDescriptor?): void
  • Makes the attribute accept null values. Opposite of NotNull. It is a shortcut for setting the allowNull option of the Attribute decorator to true.

    Parameters

    • target: Object
    • propertyName: string | symbol
    • Optional propertyDescriptor: PropertyDescriptor

    Returns void

    Example

    class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
    @Attribute(DataTypes.STRING)
    @AllowNull
    declare firstName: string | null;
    }
    • Defined in packages/core/src/decorators/legacy/attribute.ts:129

Settings

Member Visibility

Theme

Documentation
  • Loading...

Generated using TypeDoc