Implement 'GROUP BY' statement

This commit is contained in:
Pijus Kamandulis
2024-03-11 17:50:20 +02:00
parent 18edb925bf
commit b72bba86c8
6 changed files with 1120 additions and 942 deletions

View File

@@ -63,6 +63,24 @@ func Test_Parse(t *testing.T) {
)
})
t.Run("Should parse SELECT with GROUP BY", func(t *testing.T) {
testQueryParse(
t,
`SELECT c.id, c["pk"] FROM c GROUP BY c.id, c.pk`,
parsers.SelectStmt{
SelectItems: []parsers.SelectItem{
{Path: []string{"c", "id"}},
{Path: []string{"c", "pk"}},
},
Table: parsers.Table{Value: "c"},
GroupBy: []parsers.SelectItem{
{Path: []string{"c", "id"}},
{Path: []string{"c", "pk"}},
},
},
)
})
t.Run("Should parse IN function", func(t *testing.T) {
testQueryParse(
t,