diff --git a/src/QueryBuilderByLinq/Analysis/CommonTableParser.cs b/src/QueryBuilderByLinq/Analysis/CommonTableInfoParser.cs similarity index 98% rename from src/QueryBuilderByLinq/Analysis/CommonTableParser.cs rename to src/QueryBuilderByLinq/Analysis/CommonTableInfoParser.cs index cd63df1b..cf9f75a6 100644 --- a/src/QueryBuilderByLinq/Analysis/CommonTableParser.cs +++ b/src/QueryBuilderByLinq/Analysis/CommonTableInfoParser.cs @@ -3,7 +3,7 @@ namespace QueryBuilderByLinq.Analysis; -public static class CommonTableParser +public static class CommonTableInfoParser { public static List Parse(Expression exp) { diff --git a/src/QueryBuilderByLinq/Analysis/FromTableParser.cs b/src/QueryBuilderByLinq/Analysis/FromTableInfoParser.cs similarity index 99% rename from src/QueryBuilderByLinq/Analysis/FromTableParser.cs rename to src/QueryBuilderByLinq/Analysis/FromTableInfoParser.cs index 26e410c2..5c6770e2 100644 --- a/src/QueryBuilderByLinq/Analysis/FromTableParser.cs +++ b/src/QueryBuilderByLinq/Analysis/FromTableInfoParser.cs @@ -5,7 +5,7 @@ namespace QueryBuilderByLinq.Analysis; -public static class FromTableParser +public static class FromTableInfoParser { public static FromTableInfo? Parse(Expression exp) { diff --git a/src/QueryBuilderByLinq/Analysis/JoinTableParser.cs b/src/QueryBuilderByLinq/Analysis/JoinTableInfoParser.cs similarity index 84% rename from src/QueryBuilderByLinq/Analysis/JoinTableParser.cs rename to src/QueryBuilderByLinq/Analysis/JoinTableInfoParser.cs index 8bca9976..c823b063 100644 --- a/src/QueryBuilderByLinq/Analysis/JoinTableParser.cs +++ b/src/QueryBuilderByLinq/Analysis/JoinTableInfoParser.cs @@ -2,7 +2,7 @@ namespace QueryBuilderByLinq.Analysis; -public class JoinTableParser +public class JoinTableInfoParser { public static List Parse(Expression exp) { diff --git a/src/QueryBuilderByLinq/Analysis/SelectColumnInfo.cs b/src/QueryBuilderByLinq/Analysis/SelectColumnInfo.cs new file mode 100644 index 00000000..85bf9fe4 --- /dev/null +++ b/src/QueryBuilderByLinq/Analysis/SelectColumnInfo.cs @@ -0,0 +1,16 @@ +using Carbunql.Clauses; + +namespace QueryBuilderByLinq.Analysis; + +public class SelectColumnInfo +{ + public SelectColumnInfo(ValueBase value, string alias) + { + Value = value; + Alias = alias; + } + + public string Alias { get; private set; } + + public ValueBase Value { get; private set; } +} diff --git a/src/QueryBuilderByLinq/Analysis/SelectColumnInfoParser.cs b/src/QueryBuilderByLinq/Analysis/SelectColumnInfoParser.cs new file mode 100644 index 00000000..b56c2fab --- /dev/null +++ b/src/QueryBuilderByLinq/Analysis/SelectColumnInfoParser.cs @@ -0,0 +1,11 @@ +using System.Linq.Expressions; + +namespace QueryBuilderByLinq.Analysis; + +public class SelectColumnInfoParser +{ + public static List Parse(Expression exp) + { + return new List(); + } +} diff --git a/src/QueryBuilderByLinq/Analysis/WhereParser.cs b/src/QueryBuilderByLinq/Analysis/WhereInfoParser.cs similarity index 85% rename from src/QueryBuilderByLinq/Analysis/WhereParser.cs rename to src/QueryBuilderByLinq/Analysis/WhereInfoParser.cs index 09ef2779..544b7064 100644 --- a/src/QueryBuilderByLinq/Analysis/WhereParser.cs +++ b/src/QueryBuilderByLinq/Analysis/WhereInfoParser.cs @@ -3,7 +3,7 @@ namespace QueryBuilderByLinq.Analysis; -public class WhereParser +public class WhereInfoParser { public static ValueBase? Parse(Expression exp) { diff --git a/src/QueryBuilderByLinq/IQueryableExtension.cs b/src/QueryBuilderByLinq/IQueryableExtension.cs index f8141e14..1c734666 100644 --- a/src/QueryBuilderByLinq/IQueryableExtension.cs +++ b/src/QueryBuilderByLinq/IQueryableExtension.cs @@ -10,8 +10,8 @@ public static SelectQuery ToQueryAsPostgres(this IQueryable source) { var exp = (MethodCallExpression)source.Expression; //ExpressionDebugger.WriteImmediate(exp); - var ctes = CommonTableParser.Parse(exp).ToList(); - var from = FromTableParser.Parse(exp); + var ctes = CommonTableInfoParser.Parse(exp).ToList(); + var from = FromTableInfoParser.Parse(exp); var builder = new SelectQueryBuilder(exp); return builder.Build(exp); diff --git a/test/QueryBuilderByLinq.Test/Analysis/CommonTableParserTest.cs b/test/QueryBuilderByLinq.Test/Analysis/CommonTableInfoParserTest.cs similarity index 83% rename from test/QueryBuilderByLinq.Test/Analysis/CommonTableParserTest.cs rename to test/QueryBuilderByLinq.Test/Analysis/CommonTableInfoParserTest.cs index a42e6998..c27b56a1 100644 --- a/test/QueryBuilderByLinq.Test/Analysis/CommonTableParserTest.cs +++ b/test/QueryBuilderByLinq.Test/Analysis/CommonTableInfoParserTest.cs @@ -4,11 +4,11 @@ namespace QueryBuilderByLinq.Test.Analysis; -public class CommonTableParserTest +public class CommonTableInfoParserTest { private readonly QueryCommandMonitor Monitor; - public CommonTableParserTest(ITestOutputHelper output) + public CommonTableInfoParserTest(ITestOutputHelper output) { Monitor = new QueryCommandMonitor(output); Output = output; @@ -27,7 +27,7 @@ from x in FromTable(cte) Monitor.Log(query); - var ctes = CommonTableParser.Parse(query.Expression); + var ctes = CommonTableInfoParser.Parse(query.Expression); Assert.Single(ctes); Assert.Equal("cte", ctes[0].Alias); @@ -45,7 +45,7 @@ from x in FromTable(cte1) Monitor.Log(query); - var ctes = CommonTableParser.Parse(query.Expression); + var ctes = CommonTableInfoParser.Parse(query.Expression); Assert.Equal(2, ctes.Count); } @@ -65,7 +65,7 @@ from x in FromTable(cte1) Monitor.Log(query); - var ctes = CommonTableParser.Parse(query.Expression); + var ctes = CommonTableInfoParser.Parse(query.Expression); Assert.Equal(5, ctes.Count); } diff --git a/test/QueryBuilderByLinq.Test/Analysis/FromTableParserTest.cs b/test/QueryBuilderByLinq.Test/Analysis/FromTableInfoParserTest.cs similarity index 83% rename from test/QueryBuilderByLinq.Test/Analysis/FromTableParserTest.cs rename to test/QueryBuilderByLinq.Test/Analysis/FromTableInfoParserTest.cs index b5f39f9c..8a100848 100644 --- a/test/QueryBuilderByLinq.Test/Analysis/FromTableParserTest.cs +++ b/test/QueryBuilderByLinq.Test/Analysis/FromTableInfoParserTest.cs @@ -5,11 +5,11 @@ namespace QueryBuilderByLinq.Test.Analysis; -public class FromTableParserTest +public class FromTableInfoParserTest { private readonly QueryCommandMonitor Monitor; - public FromTableParserTest(ITestOutputHelper output) + public FromTableInfoParserTest(ITestOutputHelper output) { Monitor = new QueryCommandMonitor(output); Output = output; @@ -28,7 +28,7 @@ public void DualTableTest() Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Null(from); } @@ -41,7 +41,7 @@ public void TypeTableTest() Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("table_a", from?.Table?.Alias); Assert.Equal("a", from?.Alias); @@ -55,7 +55,7 @@ public void StringTableTest() Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("TABLE_A", from?.PhysicalName); Assert.Equal("a", from?.Alias); @@ -71,7 +71,7 @@ public void SubQueryTest() Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("select a.a_id from table_a as a", from?.Query?.ToOneLineText()); Assert.Equal("x", from?.Alias); @@ -88,7 +88,7 @@ from x in FromTable(cte) Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("cte", from?.PhysicalName); Assert.Equal("x", from?.Alias); @@ -106,7 +106,7 @@ from x in FromTable(cte1) Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("cte1", from?.PhysicalName); Assert.Equal("x", from?.Alias); @@ -127,7 +127,7 @@ from x in FromTable(cte1) Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("cte1", from?.PhysicalName); Assert.Equal("x", from?.Alias); @@ -145,7 +145,7 @@ from x in Dual() Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Null(from); } @@ -162,7 +162,7 @@ from x in FromTable() Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("table_a", from?.Table?.Alias); Assert.Equal("x", from?.Alias); @@ -180,7 +180,7 @@ from x in FromTable("sales") Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("sales", from?.PhysicalName); Assert.Equal("x", from?.Alias); @@ -197,7 +197,7 @@ from x in FromTable(subquery) Monitor.Log(query); - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); Assert.Equal("select a.a_id from table_a as a", from?.Query?.ToOneLineText()); Assert.Equal("x", from?.Alias); diff --git a/test/QueryBuilderByLinq.Test/CommonTableTest.cs b/test/QueryBuilderByLinq.Test/CommonTableTest.cs index d059434f..2e00385e 100644 --- a/test/QueryBuilderByLinq.Test/CommonTableTest.cs +++ b/test/QueryBuilderByLinq.Test/CommonTableTest.cs @@ -19,7 +19,7 @@ public CommonTableTest(ITestOutputHelper output) private void WriteLog(IQueryable query) { - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); if (from != null) { Output.WriteLine($"from : {from.Alias}"); diff --git a/test/QueryBuilderByLinq.Test/QueryCommandMonitor.cs b/test/QueryBuilderByLinq.Test/QueryCommandMonitor.cs index b6f3f59f..b7d579e8 100644 --- a/test/QueryBuilderByLinq.Test/QueryCommandMonitor.cs +++ b/test/QueryBuilderByLinq.Test/QueryCommandMonitor.cs @@ -15,7 +15,7 @@ public QueryCommandMonitor(ITestOutputHelper output) public void Log(IQueryable query) { - var from = FromTableParser.Parse(query.Expression); + var from = FromTableInfoParser.Parse(query.Expression); if (from != null) { Output.WriteLine("From"); @@ -30,7 +30,7 @@ public void Log(IQueryable query) } Output.WriteLine("--------------------"); - var ctes = CommonTableParser.Parse(query.Expression); + var ctes = CommonTableInfoParser.Parse(query.Expression); foreach (var cte in ctes) { Output.WriteLine($"CTE[{ctes.IndexOf(cte)}] : {cte.Alias}");