Enhance between operators to work with range values #11171
Labels
status: understood
For issues. Applied when the issue is understood / reproducible.
topic: operators
Features & issues about comparing values inside of WHERE
type: feature
For issues and PRs. For new features. Never breaking changes.
Is your feature request related to a problem? Please describe.
Sequelize v5 outputs range types in the format
[{value: X, inclusive: true}, {value:Y, inclusive:false}]
and this differs to the format provided to the [Op.between] and [Op.notBetween] operators which must be simply[FROM, TO]
.This complicates user code that could previously fetch an object with a range property and use this property value directly in a subsequent query on a scalar property with the [Op.between] operator.
Describe the solution you'd like
Enhance the [Op.between] and [Op.notBetween] operators to work with range values in addition to the simple
[FROM, TO]
array value?Why should this be in Sequelize
Simplifies new user code and reduces possibility of v5 introducing bugs into existing user code.
Describe alternatives you've considered
The alternative is to do something like:
Usage example
The user friendly approach (if it could be supported by the between operators) would be:
Additional context
Would it be possible for the between operators to check for the existence of an object with a ".value" property within the FROM/TO values in the array and use these if they exist?
The text was updated successfully, but these errors were encountered: