between method

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

Get db statement to check if this value less than another date,

other may be DateTime object or DateTimeStringField

Implementation

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