where method

QueryBuilder where(
  1. FieldName fieldName,
  2. Operator operator,
  3. dynamic value
)
inherited

Implementation

RT where(FieldName fieldName, Operator operator, value) {
  switch (operator) {
    case Operator.inList:
    case Operator.notInList:
      final values = value is Iterable ? [...value] : [value];
      if (operator == Operator.inList && values.isEmpty) {
        _containsEmptyInCondition = true;
      }
      for (final value in values) {
        _query = _query.copyWith(conditions: [
          ..._query.conditions,
          SimpleCondition(
              fieldName: fieldName,
              operator: operator == Operator.inList
                  ? Operator.equals
                  : Operator.notEquals,
              value: value)
        ]);
      }
      return this as RT;
    default:
      _query = _query.copyWith(conditions: [
        ..._query.conditions,
        SimpleCondition(
            fieldName: fieldName, operator: operator, value: value)
      ]);
      return this as RT;
  }
}