You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var aliasQuery = SELECT s.sl_name, s.sl_avail + shoelace_arrive.arr_quant, current_user, current_timestamp FROM shoelace_arrive shoelace_arrive, shoelace_data shoelace_data, shoelace_data s WHERE s.sl_name = shoelace_arrive.arr_name AND shoelace_data.sl_name = s.sl_name AND s.sl_avail + shoelace_arrive.arr_quant <> s.sl_avail
fmt.Print("TestSQLParseTree --->")
tree, err := pg_query.Parse(aliasQuery)
nodes := tree.Statements
fmt.Println(len(nodes))
for key, value := range nodes {
fmt.Printf("The key is %v", key)
switch valueType := value.(type) {
case nodes.RawStmt: //nodes.RawStmt undefined (type []"github.com/lfittl/pg_query_go/nodes".Node has no field or method RawStmt)
default:
fmt.Printf("default type is %v", valueType)
}
//fmt.Print(reflect.TypeOf(value))
}
if err != nil {
panic(err)
}
fmt.Printf("%s\n", tree)
}`
Please look at the above switch statement. My code needs to make a decision on whether the type is of nodes.RawStmt. But I get the error shown in comments when I do that.
The text was updated successfully, but these errors were encountered:
I am trying to parse a SQL query go object, but cannot switch on any of its types. For example
`func TestSQLParseAliasQueryAsObject(t *testing.T) {
var aliasQuery =
SELECT s.sl_name, s.sl_avail + shoelace_arrive.arr_quant, current_user, current_timestamp FROM shoelace_arrive shoelace_arrive, shoelace_data shoelace_data, shoelace_data s WHERE s.sl_name = shoelace_arrive.arr_name AND shoelace_data.sl_name = s.sl_name AND s.sl_avail + shoelace_arrive.arr_quant <> s.sl_avail
}`
Please look at the above switch statement. My code needs to make a decision on whether the type is of nodes.RawStmt. But I get the error shown in comments when I do that.
The text was updated successfully, but these errors were encountered: