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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//! Role specification types for DCL statements
//!
//! This module provides types for specifying roles and users in GRANT/REVOKE
//! role membership statements.
/// Role specification for GRANT/REVOKE role membership
///
/// Represents a role or user that can be granted or revoked role membership.
///
/// # PostgreSQL Support
///
/// PostgreSQL supports all variants:
/// - `RoleName`: Regular role name
/// - `CurrentRole`: Special keyword `CURRENT_ROLE`
/// - `CurrentUser`: Special keyword `CURRENT_USER`
/// - `SessionUser`: Special keyword `SESSION_USER`
///
/// # MySQL Support
///
/// MySQL supports:
/// - `RoleName`: Regular role name or `'user'@'host'` format
/// - `CurrentUser`: Special keyword `CURRENT_USER`
///
/// MySQL does not support `CurrentRole` or `SessionUser`.
///
/// # Examples
///
/// ```
/// use reinhardt_query::dcl::RoleSpecification;
///
/// // Regular role name
/// let role = RoleSpecification::new("developer");
/// assert_eq!(role, RoleSpecification::RoleName("developer".to_string()));
///
/// // PostgreSQL special keywords
/// let current_role = RoleSpecification::current_role();
/// let current_user = RoleSpecification::current_user();
/// let session_user = RoleSpecification::session_user();
///
/// // MySQL user@host format
/// let mysql_user = RoleSpecification::new("'alice'@'localhost'");
/// ```
/// Drop behavior for REVOKE statements (PostgreSQL only)
///
/// Specifies how dependent privileges should be handled when revoking
/// role membership.
///
/// # PostgreSQL Support
///
/// PostgreSQL supports both variants:
/// - `Cascade`: Automatically revoke dependent privileges
/// - `Restrict`: Reject the operation if dependent privileges exist
///
/// # MySQL Support
///
/// MySQL does not support drop behavior clauses.
///
/// # Examples
///
/// ```
/// use reinhardt_query::dcl::DropBehavior;
///
/// let cascade = DropBehavior::Cascade;
/// let restrict = DropBehavior::Restrict;
/// ```