withWhereHas<TChild> method

S withWhereHas<TChild>(
  1. MssqlRelation<TRow, TChild> relation(
    1. TFields fields
    )
)

whereHas and include of the same handle, so the loaded children are the ones the filter named.

Implementation

S withWhereHas<TChild>(
  MssqlRelation<TRow, TChild> Function(TFields fields) relation,
) {
  final rel = relation(fields);
  return include(
    (_) => <MssqlRelation<TRow, Object?>>[rel.asInclude],
  ).whereHas((_) => rel);
}