forked from pganalyze/pg_query_go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
with_check_option.go
66 lines (54 loc) · 1.49 KB
/
with_check_option.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Auto-generated from postgres/src/include/nodes/parsenodes.h - DO NOT EDIT
package pg_query
import "encoding/json"
type WithCheckOption struct {
Kind WCOKind `json:"kind"` /* kind of WCO */
Relname *string `json:"relname"` /* name of relation that specified the WCO */
Polname *string `json:"polname"` /* name of RLS policy being checked */
Qual Node `json:"qual"` /* constraint qual to check */
Cascaded bool `json:"cascaded"` /* true for a cascaded WCO on a view */
}
func (node WithCheckOption) MarshalJSON() ([]byte, error) {
type WithCheckOptionMarshalAlias WithCheckOption
return json.Marshal(map[string]interface{}{
"WithCheckOption": (*WithCheckOptionMarshalAlias)(&node),
})
}
func (node *WithCheckOption) UnmarshalJSON(input []byte) (err error) {
var fields map[string]json.RawMessage
err = json.Unmarshal(input, &fields)
if err != nil {
return
}
if fields["kind"] != nil {
err = json.Unmarshal(fields["kind"], &node.Kind)
if err != nil {
return
}
}
if fields["relname"] != nil {
err = json.Unmarshal(fields["relname"], &node.Relname)
if err != nil {
return
}
}
if fields["polname"] != nil {
err = json.Unmarshal(fields["polname"], &node.Polname)
if err != nil {
return
}
}
if fields["qual"] != nil {
node.Qual, err = UnmarshalNodeJSON(fields["qual"])
if err != nil {
return
}
}
if fields["cascaded"] != nil {
err = json.Unmarshal(fields["cascaded"], &node.Cascaded)
if err != nil {
return
}
}
return
}