where method
Implementation
@override
QueryBuilder where(
dynamic condition, [
String operator = '=',
dynamic value,
String boolean = 'and',
]) {
if (condition is String) {
final paramName = _nextParamName();
bindings[paramName] = value;
_appendCondition("$condition $operator :$paramName",
isOr: (boolean.toLowerCase() == 'or'));
} else if (condition is QueryCallback) {
QueryBuilderImpl nested = QueryBuilderImpl()
..paramCounter = _paramCounter;
condition(nested);
_appendCondition("(${nested.toSql()})",
isOr: (boolean.toLowerCase() == 'or'));
bindings.addAll(nested.getBindings());
} else {
throw InvalidArgumentException(
'Invalid argument type for condition. Expected either a String or a QueryBuilder instance',
);
}
return this;
}