compileOrders method

String compileOrders(
  1. List<Map<String, dynamic>> orders
)

Compile the "order by" portion of the query.

Implementation

String compileOrders(List<Map<String, dynamic>> orders) {
  if (orders.isEmpty) return '';

  final lines = orders.map((order) {
    if (order['type'] == 'Raw') return order['sql'];
    return '${wrap(order['column'])} ${order['direction']}';
  }).toList();

  return 'ORDER BY ${lines.join(', ')}';
}