mirror of
https://github.com/pikami/cosmium.git
synced 2025-12-19 17:00:37 +00:00
Added support for 'SELECT *'
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -112,7 +112,13 @@ TopClause <- Top ws count:Integer {
|
||||
return count, nil
|
||||
}
|
||||
|
||||
Selection <- SelectValueSpec / ColumnList
|
||||
Selection <- SelectValueSpec / ColumnList /SelectAsterisk
|
||||
|
||||
SelectAsterisk <- "*" {
|
||||
selectItem, _ := makeSelectItem("c", make([]interface{}, 0), parsers.SelectItemTypeField)
|
||||
selectItem.IsTopLevel = true
|
||||
return makeColumnList(selectItem, make([]interface{}, 0))
|
||||
}
|
||||
|
||||
ColumnList <- column:SelectItem other_columns:(ws "," ws coll:SelectItem {return coll, nil })* {
|
||||
return makeColumnList(column, other_columns)
|
||||
|
||||
@@ -79,6 +79,19 @@ func Test_Parse(t *testing.T) {
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("Should parse SELECT *", func(t *testing.T) {
|
||||
testQueryParse(
|
||||
t,
|
||||
`SELECT * FROM c`,
|
||||
parsers.SelectStmt{
|
||||
SelectItems: []parsers.SelectItem{
|
||||
{Path: []string{"c"}, IsTopLevel: true},
|
||||
},
|
||||
Table: parsers.Table{Value: "c"},
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("Should parse SELECT array", func(t *testing.T) {
|
||||
testQueryParse(
|
||||
t,
|
||||
|
||||
Reference in New Issue
Block a user