-
Notifications
You must be signed in to change notification settings - Fork 73
/
alter_seq_stmt.go
67 lines (56 loc) · 1.49 KB
/
alter_seq_stmt.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
67
// Auto-generated from postgres/src/include/nodes/parsenodes.h - DO NOT EDIT
package pg_query
import "encoding/json"
/* ----------------------
* {Create|Alter} SEQUENCE Statement
* ----------------------
*/
type AlterSeqStmt struct {
Sequence *RangeVar `json:"sequence"` /* the sequence to alter */
Options List `json:"options"`
ForIdentity bool `json:"for_identity"`
MissingOk bool `json:"missing_ok"` /* skip error if a role is missing? */
}
func (node AlterSeqStmt) MarshalJSON() ([]byte, error) {
type AlterSeqStmtMarshalAlias AlterSeqStmt
return json.Marshal(map[string]interface{}{
"AlterSeqStmt": (*AlterSeqStmtMarshalAlias)(&node),
})
}
func (node *AlterSeqStmt) UnmarshalJSON(input []byte) (err error) {
var fields map[string]json.RawMessage
err = json.Unmarshal(input, &fields)
if err != nil {
return
}
if fields["sequence"] != nil {
var nodePtr *Node
nodePtr, err = UnmarshalNodePtrJSON(fields["sequence"])
if err != nil {
return
}
if nodePtr != nil && *nodePtr != nil {
val := (*nodePtr).(RangeVar)
node.Sequence = &val
}
}
if fields["options"] != nil {
node.Options.Items, err = UnmarshalNodeArrayJSON(fields["options"])
if err != nil {
return
}
}
if fields["for_identity"] != nil {
err = json.Unmarshal(fields["for_identity"], &node.ForIdentity)
if err != nil {
return
}
}
if fields["missing_ok"] != nil {
err = json.Unmarshal(fields["missing_ok"], &node.MissingOk)
if err != nil {
return
}
}
return
}