Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ReadData = List{GRANT, SELECT} ReadWriteData = List{GRANT, SELECT, INSERT, DELETE, UPDATE} )
Predefined sets of privileges.
var ByName = map[string]Kind{ "ALL": ALL, "CREATE": CREATE, "DROP": DROP, "GRANT": GRANT, "SELECT": SELECT, "INSERT": INSERT, "DELETE": DELETE, "UPDATE": UPDATE, "ZONECONFIG": ZONECONFIG, }
ByName is a map of string -> kind value.
var ByValue = [...]Kind{ ALL, CREATE, DROP, GRANT, SELECT, INSERT, DELETE, UPDATE, ZONECONFIG, }
ByValue is just an array of privilege kinds sorted by value.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind uint32
Kind defines a privilege. This is output by the parser, and used to generate the privilege bitfields in the PrivilegeDescriptor.
const ( ALL Kind CREATE DROP GRANT SELECT INSERT DELETE UPDATE ZONECONFIG )
List of privileges. ALL is specifically encoded so that it will automatically pick up new privileges.
type List ¶
type List []Kind
List is a list of privileges.
func ListFromBitField ¶
ListFromBitField takes a bitfield of privileges and returns a list. It is ordered in increasing value of privilege.Kind.
func ListFromStrings ¶
ListFromStrings takes a list of strings and attempts to build a list of Kind. We convert each string to uppercase and search for it in the ByName map. If an entry is not found in ByName, an error is returned.
func (List) Format ¶
Format prints out the list in a buffer. This keeps the existing order and uses ", " as separator.
func (List) SortedNames ¶
SortedNames returns a list of privilege names in sorted order.
func (List) SortedString ¶
SortedString is similar to String() but returns privileges sorted by name and uses "," as separator.
func (List) String ¶
String implements the Stringer interface. This keeps the existing order and uses ", " as separator.
func (List) ToBitField ¶
ToBitField returns the bitfield representation of a list of privileges.