rawQuery method

Future<List<DatumRawRow>> rawQuery(
  1. DatumRawQuery query, {
  2. DataSource source = DataSource.local,
  3. String? userId,
})

Executes an adapter-aware raw query for projections/aggregations without hydrating entities (#11), dispatching to the local or remote adapter.

Returns raw rows. Throws UnsupportedError if the target adapter does not mix in RawQueryCapable — check manager.localAdapter is RawQueryCapable first if unsure.

Implementation

Future<List<DatumRawRow>> rawQuery(
  DatumRawQuery query, {
  DataSource source = DataSource.local,
  String? userId,
}) {
  _ensureInitialized();
  if (source == DataSource.local) {
    final a = localAdapter;
    if (a is RawQueryCapable) return (a as RawQueryCapable).rawQuery(query, userId: userId);
    throw UnsupportedError('${a.name} does not support raw queries. Mix in RawQueryCapable to enable.');
  } else {
    final a = remoteAdapter;
    if (a is RawQueryCapable) return (a as RawQueryCapable).rawQuery(query, userId: userId);
    throw UnsupportedError('${a.name} does not support raw queries. Mix in RawQueryCapable to enable.');
  }
}