withExists<TChild> method

MssqlProjectedQuery<(TRow, bool)> withExists<TChild>(
  1. MssqlRelation<TRow, TChild> relation(
    1. TFields fields
    )
)

Parent rows plus whether any matching child exists, as a bit.

Implementation

MssqlProjectedQuery<(TRow, bool)> withExists<TChild>(
  MssqlRelation<TRow, TChild> Function(TFields fields) relation,
) {
  final rel = relation(fields);
  final expr = existsValue(_existsQuery(rel));
  return _projectAdded(
    'withExists',
    expr,
    (value) => value == true || value == 1,
  );
}