limit method

PostgrestTransformBuilder limit(
  1. int count, {
  2. String? foreignTable,
})

Limits the result with the specified count.

If we want to limit a foreign column, the options need to have foreignTable value provided

postgrest.from('users').select().limit(1)
postgrest.from('users').select('messages(*)').limit(1, foreignTable: 'messages')

Implementation

PostgrestTransformBuilder limit(int count, {String? foreignTable}) {
  final key = foreignTable == null ? 'limit' : '$foreignTable.limit';

  appendSearchParams(key, '$count');
  return this;
}