between method

ConditionQuery between(
  1. dynamic min,
  2. dynamic max
)

Get a sql statement representation that check weather this value is between two values.

min,max may be of the following:

DoubleField - IntField - NumField - double - int

Implementation

ConditionQuery between(min, max) {
  DbFunctions.assertNumValues([min, max]);
  var q = ConditionQuery();
  String qString = '(${buildQuery()} BETWEEN ';
  qString += (min is NumField) ? min.buildQuery() : '?';
  qString += ' AND ';
  qString += (max is NumField) ? max.buildQuery() : '?';
  qString += ')';
  q.queryBuilder = () => qString;
  q.parametersBuilder = () => [
        ...getParameters(),
        if (min is NumField) ...min.getParameters() else min,
        if (max is NumField) ...max.getParameters() else max
      ];
  return q;
}