sqlFormatter function
Compose all formatters
Implementation
String sqlFormatter(AllClauses clauses, FormattingOptions options) => [
formatClause('SELECT', clauses.selectClause, options),
formatClause('FROM', clauses.fromClause, options),
if (clauses.joinClause.isNotEmpty)
formatClause(
'INNER JOIN',
clauses.joinClause
.trim()
.split(' ON ')[0]
.replaceAll('INNER JOIN ', ''),
options,
),
if (clauses.joinClause.isNotEmpty)
formatClause(
'ON',
clauses.joinClause.trim().split(' ON ')[1],
options,
isSubclause: true,
),
formatClause('WHERE', clauses.whereClause, options, isSubclause: true),
formatClause(
'ORDER BY',
clauses.orderByClause,
options,
isSubclause: true,
),
].where((s) => s.isNotEmpty).join(options.newline);