2018-10-18 21:52:05 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using PoweredSoft.DynamicQuery.Core;
|
|
|
|
|
|
|
|
|
|
namespace PoweredSoft.DynamicQuery
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents an aggregate result.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AggregateResult : IAggregateResult
|
|
|
|
|
{
|
|
|
|
|
public string Path { get; set; }
|
|
|
|
|
public AggregateType Type { get; set; }
|
|
|
|
|
public object Value { get; set; }
|
2018-10-21 16:20:17 -04:00
|
|
|
|
|
|
|
|
|
public bool ShouldSerializePath() => !string.IsNullOrWhiteSpace(Path);
|
2018-10-18 21:52:05 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// part of a result.
|
|
|
|
|
public abstract class QueryResult : IQueryResult
|
|
|
|
|
{
|
|
|
|
|
public List<IAggregateResult> Aggregates { get; set; }
|
|
|
|
|
public List<object> Data { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool ShouldSerializeAggregates() => Aggregates != null;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-21 15:15:26 -04:00
|
|
|
|
// just result
|
2018-10-18 21:52:05 -04:00
|
|
|
|
public class QueryExecutionResult : QueryResult, IQueryExecutionResult
|
|
|
|
|
{
|
|
|
|
|
public long TotalRecords { get; set; }
|
|
|
|
|
public long? NumberOfPages { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-21 15:15:26 -04:00
|
|
|
|
// group result.
|
2018-10-18 21:52:05 -04:00
|
|
|
|
public class GroupQueryResult : QueryResult, IGroupQueryResult
|
|
|
|
|
{
|
|
|
|
|
public string GroupPath { get; set; }
|
|
|
|
|
public object GroupValue { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|