statementToSql function

String statementToSql(
  1. SelectStatement statement, {
  2. Formatter<List<SelectedColumn>> selectFormatter = defaultSelectFormatter,
  3. Formatter<String> fromFormatter = identity,
  4. Formatter<List<Join>> joinFormatter = defaultJoinFormatter,
  5. Formatter<WhereClauseGroup> whereFormatter = defaultWhereFormatter,
  6. Formatter<List<OrderByElement>> orderByFormatter = defaultOrderByFormatter,
  7. Formatter<AllClauses> allClausesFormatter = defaultAllClausesFormatter,
})

Converts a SelectStatement to an SQL string.

Implementation

String statementToSql(
  SelectStatement statement, {
  Formatter<List<SelectedColumn>> selectFormatter = defaultSelectFormatter,
  Formatter<String> fromFormatter = identity,
  Formatter<List<Join>> joinFormatter = defaultJoinFormatter,
  Formatter<WhereClauseGroup> whereFormatter = defaultWhereFormatter,
  Formatter<List<OrderByElement>> orderByFormatter = defaultOrderByFormatter,
  Formatter<AllClauses> allClausesFormatter = defaultAllClausesFormatter,
}) =>
    allClausesFormatter(
      (
        selectClause: selectFormatter(statement.select),
        fromClause: fromFormatter(statement.from),
        joinClause: joinFormatter(statement.joins),
        whereClause: whereFormatter(statement.where),
        orderByClause: orderByFormatter(statement.orderBy)
      ),
    );