whereNone method

  1. @override
QueryBuilderInterface<T> whereNone(
  1. Map<String, dynamic> conditions
)
override

Matches NONE of the conditions

Implementation

@override
QueryBuilderInterface<T> whereNone(Map<String, dynamic> conditions) {
  if (conditions.isEmpty) return this;

  final subquery = QueryBuilder<dynamic>(connection, grammar, _table);
  conditions.forEach((column, value) {
    subquery.orWhere(column, '=', value);
  });

  final sql = grammar.compileWheres(subquery.wheres);
  // Remove leading WHERE
  final cleanSql = sql.replaceFirst('WHERE ', '');

  return whereRaw('NOT ($cleanSql)', subquery.bindings);
}