Path: redb/redb.Core/Query/Grouping/IGroupedWindowedQueryable.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/IGroupedWindowedQueryable.cs
----
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using redb.Core.Models.Contracts;
namespace redb.Core.Query.Grouping;
///
/// Queryable for applying window functions to grouped data.
/// Allows ranking, running totals, and other analytics on aggregated results.
///
/// Group key type
/// Object properties type
public interface IGroupedWindowedQueryable
{
///
/// Execute query and materialize results with window functions applied to groups.
///
/// Result type
/// Projection expression with group aggregations and window functions
/// List of results with window calculations
/// Cancels the operation (OCE only; a rollback in flight always completes).
Task> SelectAsync(
Expression, TResult>> selector,
CancellationToken cancellationToken = default);
///
/// Get SQL preview for debugging.
///
Task ToSqlStringAsync(
Expression, TResult>> selector,
CancellationToken cancellationToken = default);
}
///
/// Window specification for grouped queries.
///
/// Group key type
/// Object properties type
public interface IGroupedWindowSpec
{
///
/// Partition window by group key field (for ranking within partitions).
///
IGroupedWindowSpec PartitionBy(
Expression> keySelector);
///
/// Order rows within window ascending.
///
IGroupedWindowSpec OrderBy(
Expression, TField>> orderSelector);
///
/// Order rows within window descending.
///
IGroupedWindowSpec OrderByDesc(
Expression, TField>> orderSelector);
}