distinct static method

QueryPart distinct(
  1. List<FieldWithValue> fields
)

Create sql statement with function DISTINCT() function applied. DISTINCT() is used to get rows without duplicates of fields values.

Implementation

static QueryPart distinct(List<FieldWithValue> fields) {
  assert(fields.isNotEmpty);
  QueryPart result = QueryPart._();
  String qText = 'DISTINCT ';
  for (var element in fields) {
    qText += '${element.buildQuery()},';
  }
  qText = qText.substring(0, qText.length - 1);
  qText += ' ';
  result.queryBuilder = () => qText;
  result.parametersBuilder =
      () => [for (var f in fields) ...f.getParameters()];
  return result;
}