Class ProTreeQueryProvider
ProTreeQueryProvider - Aggregation for trees (partial).
CTE for tree traversal + aggregations.
✅ DRY: Uses ProSqlBuilder for common operations.
public class ProTreeQueryProvider : PostgresTreeQueryProvider, ITreeQueryProvider, IRedbQueryProvider
Inheritance
Implements
Inherited Members
Methods
CreateFilterParser()
Pro: Uses ProFilterExpressionParser with arithmetic and function support
protected override ProFilterExpressionParser CreateFilterParser()
ExecuteAggregateAsync(long, string, AggregateFunction, string?)
Execute aggregation on EAV field (SQL strategy for simple fields).
public override Task<decimal?> ExecuteAggregateAsync(long schemeId, string fieldPath, AggregateFunction function, string? filterJson = null)
ExecuteAggregateBatchAsync(long, IEnumerable<AggregateRequest>, string?)
Execute batch aggregation (multiple fields in one query).
public override Task<AggregateResult> ExecuteAggregateBatchAsync(long schemeId, IEnumerable<AggregateRequest> requests, string? filterJson = null)
ExecuteArrayGroupedAggregateAsync(long, string, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?)
Execute GroupBy aggregation on array (SQL function aggregate_array_grouped).
public override Task<JsonDocument?> ExecuteArrayGroupedAggregateAsync(long schemeId, string arrayPath, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? filterJson = null)
ExecuteGroupedAggregateAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?)
Execute GroupBy aggregation (SQL function aggregate_grouped).
public override Task<JsonDocument?> ExecuteGroupedAggregateAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? filterJson = null)
ExecuteTreeAggregateAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<AggregateRequest>)
Execute tree aggregation with CTE.
public Task<Dictionary<string, decimal?>> ExecuteTreeAggregateAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<AggregateRequest> aggregations) where TProps : class, new()
ExecuteTreeCountAsync<TProps>(TreeQueryContext<TProps>)
⚡ Pro Override: Tree Count via CTE + PVT.
protected override Task<int> ExecuteTreeCountAsync<TProps>(TreeQueryContext<TProps> context) where TProps : class, new()
ExecuteTreeGroupByAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>)
Execute GROUP BY on tree with CTE.
public Task<string> ExecuteTreeGroupByAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations) where TProps : class, new()
ExecuteTreeGroupedAggregateAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>)
ITreeQueryProvider implementation: Execute GROUP BY with tree context.
public override Task<JsonDocument?> ExecuteTreeGroupedAggregateAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations) where TProps : class, new()
ExecuteTreeGroupedWindowQueryAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>)
Execute Tree GroupBy + Window query.
public override Task<JsonDocument?> ExecuteTreeGroupedWindowQueryAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy) where TProps : class, new()
ExecuteTreeToListAsync<TProps>(TreeQueryContext<TProps>)
⚡ Pro Override: Tree ToList via CTE + PVT.
protected override Task<object> ExecuteTreeToListAsync<TProps>(TreeQueryContext<TProps> context) where TProps : class, new()
ExecuteTreeWindowAsync<TProps>(TreeQueryContext<TProps>, string, string, string, string, string?)
Execute Window Functions on tree with CTE (legacy JSON version).
public Task<string> ExecuteTreeWindowAsync<TProps>(TreeQueryContext<TProps> context, string selectFieldsJson, string windowFunctionsJson, string partitionByJson, string orderByJson, string? frameJson = null) where TProps : class, new()
ExecuteTreeWindowQueryAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?)
Execute Window Functions on tree with CTE (interface implementation).
public override Task<JsonDocument?> ExecuteTreeWindowQueryAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? frameJson = null) where TProps : class, new()
ExecuteWindowQueryAsync(long, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, string?, int?, int?)
Execute query with window functions (SQL function query_with_window).
public override Task<JsonDocument?> ExecuteWindowQueryAsync(long schemeId, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? filterJson = null, string? frameJson = null, int? take = null, int? skip = null)
GetGroupBySqlPreviewAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?)
Returns SQL preview for GroupBy query with tree constraints.
public Task<string> GetGroupBySqlPreviewAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? filterJson = null)
GetSchemeAsync(long)
Get scheme by ID (for projections) - delegate to base provider
public override Task<IRedbScheme?> GetSchemeAsync(long schemeId)
GetSqlPreviewAsync<TProps>(TreeQueryContext<TProps>)
Pro: Tree SQL Preview (DRY - uses BuildTreeQuerySqlAsync)
public override Task<string> GetSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context) where TProps : class, new()
GetTreeAggregateSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<AggregateRequest>)
SQL Preview for Tree Aggregate (DRY - same SQL as Execute)
public Task<string> GetTreeAggregateSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<AggregateRequest> aggregations) where TProps : class, new()
GetTreeGroupBySqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>)
SQL Preview for Tree GroupBy (DRY - same SQL as Execute)
public override Task<string> GetTreeGroupBySqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations) where TProps : class, new()
GetTreeGroupedWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>)
SQL preview for Tree GroupBy + Window.
public override Task<string> GetTreeGroupedWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy) where TProps : class, new()
GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?)
SQL Preview for Tree Window (typed interface version).
public override Task<string> GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? frameJson = null) where TProps : class, new()
GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, string, string, string, string, string?)
SQL Preview for Tree Window (DRY - same SQL as Execute)
public Task<string> GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, string selectFieldsJson, string windowFunctionsJson, string partitionByJson, string orderByJson, string? frameJson = null) where TProps : class, new()