toSql method

String toSql()

Implementation

String toSql() {
  if (type == null) {
    throw Exception('Type no puede ser nulo.');
  }

  String str = '';

  if (type == WhereType.whereClause) {
    WhereClause clause = WhereClause();

    callback!(clause);

    str += '(' + clause.toSql() + ')';

    return str;
  }

  str += column!;

  if (type == WhereType.whereIn) {
    str += ' ' + _toSqlForIn();

    return str;
  }

  if (type == WhereType.whereValue) {
    str += ' $comparator ${queryValue(value)}';

    return str;
  }

  if (type == WhereType.whereColumn) {
    str += ' $comparator ${identifierValue(value)}';

    return str;
  }

  return str;
}