Path: redb/redb.Core/Query/Grouping/IRedbGroupedQueryable.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Query/Grouping/IRedbGroupedQueryable.cs
----
using System.Linq.Expressions;
namespace redb.Core.Query.Grouping;
///
/// Interface for grouped REDB queries.
/// Allows executing aggregations per group via SelectAsync.
///
public interface IRedbGroupedQueryable
{
///
/// Executes projection with aggregations for each group.
///
Task> SelectAsync(
Expression, TResult>> selector,
CancellationToken cancellationToken = default);
///
/// Returns group count.
///
Task CountAsync(CancellationToken cancellationToken = default);
///
/// Returns SQL string that will be executed for this GroupBy query.
/// Useful for debugging and diagnostics.
///
Task ToSqlStringAsync(
Expression, TResult>> selector,
CancellationToken cancellationToken = default);
///
/// Filter groups by a predicate over aggregates (SQL HAVING).
/// The predicate must reference the grouped projection only through
/// helpers, e.g.:
/// .Having(g => Agg.Count(g) > 5 && Agg.Sum(g, x => x.Salary) > 1000).
/// Multiple Having calls compose with logical AND.
///
IRedbGroupedQueryable Having(
System.Linq.Expressions.Expression, bool>> predicate);
///
/// Apply window functions to grouped results.
/// Allows ranking, running totals, and other analytics on aggregated data.
///
/// Window specification (partition, order)
/// Grouped windowed queryable for further projection
IGroupedWindowedQueryable WithWindow(
Action> windowConfig);
}