Implement IIF function; Fix empty object select

This commit is contained in:
Pijus Kamandulis
2025-05-14 18:48:20 +03:00
parent 30195fae96
commit 7e0c10479b
10 changed files with 1865 additions and 1581 deletions

View File

@@ -163,4 +163,27 @@ func Test_Parse(t *testing.T) {
},
)
})
t.Run("Should parse IIF function", func(t *testing.T) {
testQueryParse(
t,
`SELECT IIF(true, c.pk, c.id) FROM c`,
parsers.SelectStmt{
SelectItems: []parsers.SelectItem{
{
Type: parsers.SelectItemTypeFunctionCall,
Value: parsers.FunctionCall{
Type: parsers.FunctionCallIif,
Arguments: []interface{}{
testutils.SelectItem_Constant_Bool(true),
testutils.SelectItem_Path("c", "pk"),
testutils.SelectItem_Path("c", "id"),
},
},
},
},
Table: parsers.Table{SelectItem: testutils.SelectItem_Path("c")},
},
)
})
}