first method

Future<TRow?> first()

The first matching row in the requested order, or null.

Implementation

Future<TRow?> first() async {
  final dialect = await _resolvedDialect();
  final scopes = context.scopeCompiler(state.scope);
  final loader = _loaderFor(session, dialect);
  final row = await _select(scopes: scopes).first(
    session,
    dialect: dialect,
    timeout: state.options.timeout,
    cancellationToken: state.options.cancellationToken,
    options: state.options,
  );
  if (row == null) return null;
  final attached = await _attachOn(
    session,
    <TRow>[binding.fromRow(row)],
    dialect: dialect,
    loader: loader,
  );
  return attached.single;
}