forked from pganalyze/pg_query_go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
a_const.go
45 lines (36 loc) · 939 Bytes
/
a_const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Auto-generated from postgres/src/include/nodes/parsenodes.h - DO NOT EDIT
package pg_query
import "encoding/json"
/*
* A_Const - a literal constant
*/
type A_Const struct {
Val Node `json:"val"` /* value (includes type info, see value.h) */
Location int `json:"location"` /* token location, or -1 if unknown */
}
func (node A_Const) MarshalJSON() ([]byte, error) {
type A_ConstMarshalAlias A_Const
return json.Marshal(map[string]interface{}{
"A_Const": (*A_ConstMarshalAlias)(&node),
})
}
func (node *A_Const) UnmarshalJSON(input []byte) (err error) {
var fields map[string]json.RawMessage
err = json.Unmarshal(input, &fields)
if err != nil {
return
}
if fields["val"] != nil {
node.Val, err = UnmarshalNodeJSON(fields["val"])
if err != nil {
return
}
}
if fields["location"] != nil {
err = json.Unmarshal(fields["location"], &node.Location)
if err != nil {
return
}
}
return
}