-
Notifications
You must be signed in to change notification settings - Fork 73
/
create_seq_stmt.go
75 lines (63 loc) · 1.72 KB
/
create_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
68
69
70
71
72
73
74
75
// Auto-generated from postgres/src/include/nodes/parsenodes.h - DO NOT EDIT
package pg_query
import "encoding/json"
/* ----------------------
* {Create|Alter} SEQUENCE Statement
* ----------------------
*/
type CreateSeqStmt struct {
Sequence *RangeVar `json:"sequence"` /* the sequence to create */
Options List `json:"options"`
OwnerId Oid `json:"ownerId"` /* ID of owner, or InvalidOid for default */
ForIdentity bool `json:"for_identity"`
IfNotExists bool `json:"if_not_exists"` /* just do nothing if it already exists? */
}
func (node CreateSeqStmt) MarshalJSON() ([]byte, error) {
type CreateSeqStmtMarshalAlias CreateSeqStmt
return json.Marshal(map[string]interface{}{
"CreateSeqStmt": (*CreateSeqStmtMarshalAlias)(&node),
})
}
func (node *CreateSeqStmt) 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["ownerId"] != nil {
err = json.Unmarshal(fields["ownerId"], &node.OwnerId)
if err != nil {
return
}
}
if fields["for_identity"] != nil {
err = json.Unmarshal(fields["for_identity"], &node.ForIdentity)
if err != nil {
return
}
}
if fields["if_not_exists"] != nil {
err = json.Unmarshal(fields["if_not_exists"], &node.IfNotExists)
if err != nil {
return
}
}
return
}