Moves the byte-identical 19-file ExpressionFactory/Query tree (duplicated across Snowflake and SqlServer) into the new Strata.SqlTools.Query project under the flat namespace Strata.SqlTools.Query. Both dialect projects now reference the shared project; the Snowflake copies are deleted. Also folds in the IDE0028 fix on CalculationFilterGroup.GetValidFilters (collection expression []), which resolves both new-code IDE0028 smells in one place now that there is a single copy. Eliminates the 63 new duplicate lines flagged on the PR and removes the largest contributor to the project's 11.1% duplication density. No behavioral change: the moved types are identical to the originals. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Strata.SqlTools.Query;
|
|
|
|
public class Value
|
|
{
|
|
public string ColumnAlias { get; }
|
|
public string Calculation { get; }
|
|
public IEnumerable<int> CalculationDataColumnIds { get; }
|
|
public IEnumerable<string> AliasedIds { get; }
|
|
|
|
public IEnumerable<CalculationFilterGroup> FilterGroups { get; }
|
|
|
|
public Value() : this(string.Empty, string.Empty, new int[0], new string[0], new CalculationFilterGroup[0])
|
|
{
|
|
// FilterGroups = new List<CalculationFilterGroup>();
|
|
}
|
|
|
|
[JsonConstructor]
|
|
public Value(string columnAlias, string calculation, IEnumerable<int> calculationDataColumnIds, IEnumerable<string> aliasedIds, IEnumerable<CalculationFilterGroup> filterGroups)
|
|
{
|
|
ColumnAlias = columnAlias;
|
|
Calculation = calculation;
|
|
CalculationDataColumnIds = calculationDataColumnIds ?? Array.Empty<int>();
|
|
AliasedIds = aliasedIds ?? aliasedIds ?? Array.Empty<string>();
|
|
FilterGroups = filterGroups?.Where(x => x.IsValid()).ToList() ?? new List<CalculationFilterGroup>();
|
|
}
|
|
}
|