forked from pganalyze/pg_query_go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grant_role_stmt_fingerprint.go
60 lines (48 loc) · 1.32 KB
/
grant_role_stmt_fingerprint.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
// Auto-generated - DO NOT EDIT
package pg_query
import "strconv"
func (node GrantRoleStmt) Fingerprint(ctx FingerprintContext, parentNode Node, parentFieldName string) {
ctx.WriteString("GrantRoleStmt")
if node.AdminOpt {
ctx.WriteString("admin_opt")
ctx.WriteString(strconv.FormatBool(node.AdminOpt))
}
if int(node.Behavior) != 0 {
ctx.WriteString("behavior")
ctx.WriteString(strconv.Itoa(int(node.Behavior)))
}
if len(node.GrantedRoles.Items) > 0 {
subCtx := FingerprintSubContext{}
node.GrantedRoles.Fingerprint(&subCtx, node, "GrantedRoles")
if len(subCtx.parts) > 0 {
ctx.WriteString("granted_roles")
for _, part := range subCtx.parts {
ctx.WriteString(part)
}
}
}
if len(node.GranteeRoles.Items) > 0 {
subCtx := FingerprintSubContext{}
node.GranteeRoles.Fingerprint(&subCtx, node, "GranteeRoles")
if len(subCtx.parts) > 0 {
ctx.WriteString("grantee_roles")
for _, part := range subCtx.parts {
ctx.WriteString(part)
}
}
}
if node.Grantor != nil {
subCtx := FingerprintSubContext{}
node.Grantor.Fingerprint(&subCtx, node, "Grantor")
if len(subCtx.parts) > 0 {
ctx.WriteString("grantor")
for _, part := range subCtx.parts {
ctx.WriteString(part)
}
}
}
if node.IsGrant {
ctx.WriteString("is_grant")
ctx.WriteString(strconv.FormatBool(node.IsGrant))
}
}