select method

PostgrestFilterBuilder select([
  1. String columns = '*'
])

Performs horizontal filtering with SELECT.

postgrest.from('users').select('id, messages');

Implementation

PostgrestFilterBuilder select([String columns = '*']) {
  method = 'GET';

  // Remove whitespaces except when quoted
  var quoted = false;
  final re = RegExp(r'\s');
  final cleanedColumns = columns.split('').map((c) {
    if (re.hasMatch(c) && !quoted) {
      return '';
    }
    if (c == '"') {
      quoted = !quoted;
    }
    return c;
  }).join();

  appendSearchParams('select', cleanedColumns);
  return PostgrestFilterBuilder(this);
}