Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WhereOperators<AttributeType>

Operators that can be used in WhereOptions

Type parameters

Hierarchy

  • WhereOperators

Index

Properties

[adjacent]?: AttributeType extends Range<RangeType> ? Rangable<RangeType> : DynamicValues<AttributeType>

PG only

Whether the two ranges are adjacent.

example:
{ rangeAttribute: { [Op.adjacent]: [1, 2] } }
// results in
// "rangeAttribute" -|- [1, 2)

https://www.postgresql.org/docs/14/functions-range.html

[between]?: Literal | [lowerInclusive: OperatorValues<NonNullable<AttributeType>>, higherInclusive: OperatorValues<NonNullable<AttributeType>>]
example:

[Op.between]: [6, 10], becomes BETWEEN 6 AND 10

[contained]?: AttributeType extends any[] ? undefined | AllowAnyAll<DynamicValues<AttributeType> | (AttributeType extends Range<RangeType> ? Rangable<RangeType> : AttributeType extends any[] ? StaticValues<NonNullable<AttributeType>> : never)> : AllowAnyAll<OperatorValues<Rangable<AttributeType>>>

PG array & range 'contained by' operator

example:

[Op.contained]: [1, 2] becomes <@ [1, 2]

[contains]?: AttributeType extends Range<RangeType> ? OperatorValues<OperatorValues<NonNullable<RangeType>>> : undefined | AllowAnyAll<DynamicValues<AttributeType> | (AttributeType extends Range<RangeType> ? Rangable<RangeType> : AttributeType extends any[] ? StaticValues<NonNullable<AttributeType>> : never)>

PG array & range 'contains' operator

example:

[Op.contains]: [1, 2] becomes @> [1, 2]

[endsWith]?: OperatorValues<Extract<AttributeType, string>>

String ends with value.

[eq]?: AllowAnyAll<OperatorValues<AttributeType>>
example:

[Op.eq]: 6, becomes = 6

example:

[Op.eq]: [6, 7] becomes = ARRAY[6, 7]

example:

[Op.eq]: null becomes IS NULL

example:

[Op.eq]: true becomes = true

example:

[Op.eq]: literal('raw sql') becomes = raw sql

example:

[Op.eq]: col('column') becomes = "column"

example:

[Op.eq]: fn('NOW') becomes = NOW()

[gt]?: AllowAnyAll<OperatorValues<NonNullable<AttributeType>>>
example:

[Op.gt]: 6 becomes > 6

[gte]?: AllowAnyAll<OperatorValues<NonNullable<AttributeType>>>
example:

[Op.gte]: 6 becomes >= 6

[iLike]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>

case insensitive PG only

example:

[Op.iLike]: '%hat' becomes ILIKE '%hat'

example:

[Op.iLike]: { [Op.any]: ['cat', 'hat']} becomes ILIKE ANY (ARRAY['cat', 'hat'])

[iRegexp]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>

PG only

Matches regular expression, case insensitive

example:

[Op.iRegexp]: '^[h|a|t]' becomes ~* '^[h|a|t]'

[in]?: Literal | readonly OperatorValues<NonNullable<AttributeType>>[]
example:

[Op.in]: [1, 2], becomes IN (1, 2)

[is]?: Literal | Extract<AttributeType, null | boolean>
example:

[Op.is]: null becomes IS NULL

example:

[Op.is]: true becomes IS TRUE

example:

[Op.is]: literal('value') becomes IS value

[like]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>
example:

[Op.like]: '%hat', becomes LIKE '%hat'

example:

[Op.like]: { [Op.any]: ['cat', 'hat'] } becomes LIKE ANY (ARRAY['cat', 'hat'])

[lt]?: AllowAnyAll<OperatorValues<NonNullable<AttributeType>>>
example:

[Op.lt]: 10 becomes < 10

[lte]?: AllowAnyAll<OperatorValues<NonNullable<AttributeType>>>
example:

[Op.lte]: 10 becomes <= 10

[match]?: AllowAnyAll<DynamicValues<AttributeType>>
example:

[Op.match]: Sequelize.fn('to_tsquery', 'fat & rat') becomes @@ to_tsquery('fat & rat')

[ne]?: AllowAnyAll<OperatorValues<AttributeType>>
example:

[Op.ne]: 20, becomes != 20

example:

[Op.ne]: [20, 21] becomes != ARRAY[20, 21]

example:

[Op.ne]: null becomes IS NOT NULL

example:

[Op.ne]: true becomes != true

example:

[Op.ne]: literal('raw sql') becomes != raw sql

example:

[Op.ne]: col('column') becomes != "column"

example:

[Op.ne]: fn('NOW') becomes != NOW()

[noExtendLeft]?: AttributeType extends Range<RangeType> ? Rangable<RangeType> : DynamicValues<AttributeType>

PG only

Whether the range extends to the left of the other range.

example:
{ rangeAttribute: { [Op.noExtendLeft]: [1, 2] } }
// results in
// "rangeAttribute" &> [1, 2)

https://www.postgresql.org/docs/14/functions-range.html

[noExtendRight]?: AttributeType extends Range<RangeType> ? Rangable<RangeType> : DynamicValues<AttributeType>

PG only

Whether the range extends to the right of the other range.

example:
{ rangeAttribute: { [Op.noExtendRight]: [1, 2] } }
// results in
// "rangeAttribute" &< [1, 2)

https://www.postgresql.org/docs/14/functions-range.html

[notBetween]?: Literal | [lowerInclusive: OperatorValues<NonNullable<AttributeType>>, higherInclusive: OperatorValues<NonNullable<AttributeType>>]
example:

[Op.notBetween]: [11, 15], becomes NOT BETWEEN 11 AND 15

[notEndsWith]?: OperatorValues<Extract<AttributeType, string>>

String not ends with value.

[notILike]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>

PG only

example:

[Op.notILike]: '%hat' becomes NOT ILIKE '%hat'

example:

[Op.notILike]: { [Op.any]: ['cat', 'hat']} becomes NOT ILIKE ANY (ARRAY['cat', 'hat'])

[notIRegexp]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>

PG only

Does not match regular expression, case insensitive

example:

[Op.notIRegexp]: '^[h|a|t]' becomes !~* '^[h|a|t]'

[notIn]?: Literal | readonly OperatorValues<NonNullable<AttributeType>>[]
example:

[Op.notIn]: [1, 2], becomes NOT IN (1, 2)

[notLike]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>
example:

[Op.notLike]: '%hat' becomes NOT LIKE '%hat'

example:

[Op.notLike]: { [Op.any]: ['cat', 'hat']} becomes NOT LIKE ANY (ARRAY['cat', 'hat'])

[notRegexp]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>

MySQL/PG only

Does not match regular expression, case sensitive

example:

[Op.notRegexp]: '^[h|a|t]' becomes NOT REGEXP/!~ '^[h|a|t]'

[notStartsWith]?: OperatorValues<Extract<AttributeType, string>>

Strings not starts with value.

[notSubstring]?: OperatorValues<Extract<AttributeType, string>>

String not contains value.

[not]?: AllowAnyAll<OperatorValues<AttributeType>>
example:

[Op.not]: true becomes IS NOT TRUE

example:

{ col: { [Op.not]: { [Op.gt]: 5 } } } becomes NOT (col > 5)

[overlap]?: AllowAnyAll<DynamicValues<AttributeType> | (AttributeType extends Range<RangeType> ? Rangable<RangeType> : AttributeType extends any[] ? StaticValues<NonNullable<AttributeType>> : never)>

PG array & range 'overlaps' operator

example:

[Op.overlap]: [1, 2] becomes && [1, 2]

[regexp]?: AllowAnyAll<OperatorValues<Extract<AttributeType, string>>>

MySQL/PG only

Matches regular expression, case sensitive

example:

[Op.regexp]: '^[h|a|t]' becomes REGEXP/~ '^[h|a|t]'

[startsWith]?: OperatorValues<Extract<AttributeType, string>>

Strings starts with value.

[strictLeft]?: AttributeType extends Range<RangeType> ? Rangable<RangeType> : DynamicValues<AttributeType>

PG only

Whether the range is strictly left of the other range.

example:
{ rangeAttribute: { [Op.strictLeft]: [1, 2] } }
// results in
// "rangeAttribute" << [1, 2)

https://www.postgresql.org/docs/14/functions-range.html

[strictRight]?: AttributeType extends Range<RangeType> ? Rangable<RangeType> : DynamicValues<AttributeType>

PG only

Whether the range is strictly right of the other range.

example:
{ rangeAttribute: { [Op.strictRight]: [1, 2] } }
// results in
// "rangeAttribute" >> [1, 2)

https://www.postgresql.org/docs/14/functions-range.html

[substring]?: OperatorValues<Extract<AttributeType, string>>

String contains value.

Generated using TypeDoc