You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.8 KiB
46 lines
1.8 KiB
using Connected.Expressions.Collections;
|
|
using Connected.Expressions.Formatters;
|
|
using Connected.Expressions.Translation;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq.Expressions;
|
|
|
|
namespace Connected.Expressions;
|
|
|
|
public sealed class SelectExpression : AliasedExpression
|
|
{
|
|
public SelectExpression(Alias alias, IEnumerable<ColumnDeclaration> columns, Expression from, Expression? where,
|
|
IEnumerable<OrderExpression>? orderBy, IEnumerable<Expression>? groupBy, bool isDistinct, Expression? skip, Expression? take, bool isReverse)
|
|
: base(DatabaseExpressionType.Select, typeof(void), alias)
|
|
{
|
|
Columns = columns.ToReadOnly();
|
|
IsDistinct = isDistinct;
|
|
From = from;
|
|
Where = where;
|
|
OrderBy = orderBy?.ToReadOnly();
|
|
GroupBy = groupBy?.ToReadOnly();
|
|
Take = take;
|
|
Skip = skip;
|
|
IsReverse = isReverse;
|
|
}
|
|
|
|
public SelectExpression(Alias alias, IEnumerable<ColumnDeclaration> columns, Expression from, Expression? where, IEnumerable<OrderExpression>? orderBy, IEnumerable<Expression>? groupBy)
|
|
: this(alias, columns, from, where, orderBy, groupBy, false, null, null, false)
|
|
{
|
|
}
|
|
|
|
public SelectExpression(Alias alias, IEnumerable<ColumnDeclaration> columns, Expression from, Expression? where)
|
|
: this(alias, columns, from, where, null, null)
|
|
{
|
|
}
|
|
|
|
public ReadOnlyCollection<ColumnDeclaration> Columns { get; }
|
|
public Expression From { get; }
|
|
public Expression? Where { get; }
|
|
public ReadOnlyCollection<OrderExpression>? OrderBy { get; }
|
|
public ReadOnlyCollection<Expression>? GroupBy { get; }
|
|
public bool IsDistinct { get; }
|
|
public Expression? Skip { get; }
|
|
public Expression? Take { get; }
|
|
public bool IsReverse { get; }
|
|
public string QueryText => SqlFormatter.Format(this);
|
|
} |