Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( AllPrivileges = List{ALL, SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, USAGE, SET, ALTERSYSTEM} ReadData = List{ALL, SELECT} ReadWriteData = List{ALL, SELECT, INSERT, DELETE, UPDATE} DatabasePrivileges = List{ALL, CREATE, CONNECT, TEMPORARY} LargeObjectPrivileges = List{ALL, SELECT, UPDATE} ParameterPrivileges = List{ALL, SET, ALTERSYSTEM} TablePrivileges = List{ALL, SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER} TableColumnPrivileges = List{ALL, SELECT, INSERT, UPDATE, REFERENCES} SequencePrivileges = List{ALL, SELECT, UPDATE, USAGE} SchemaPrivileges = List{ALL, CREATE, USAGE} // UsagePrivilege is used for domains, foreign data wrappers, foreign servers, languages and types UsagePrivilege = List{ALL, USAGE} // ExecutePrivilege is used for functions and procedures ExecutePrivilege = List{ALL, EXECUTE} )
Predefined sets of privileges.
var ByName = map[string]Kind{ "ALL": ALL, "CREATE": CREATE, "SELECT": SELECT, "INSERT": INSERT, "DELETE": DELETE, "UPDATE": UPDATE, "USAGE": USAGE, "TRUNCATE": TRUNCATE, "REFERENCES": REFERENCES, "TRIGGER": TRIGGER, "EXECUTE": EXECUTE, "CONNECT": CONNECT, "TEMP": TEMPORARY, "TEMPORARY": TEMPORARY, "SET": SET, "ALTER SYSTEM": ALTERSYSTEM, }
ByName is a map of string -> kind value.
var ByValue = [...]Kind{ ALL, SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, USAGE, SET, ALTERSYSTEM, }
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 SELECT INSERT UPDATE DELETE TRUNCATE REFERENCES TRIGGER CREATE CONNECT TEMPORARY EXECUTE USAGE SET ALTERSYSTEM )
List of privileges. ALL is specifically encoded so that it will automatically pick up new privileges.
func KindFromString ¶ added in v0.4.0
type List ¶
type List []Kind
List is a list of privileges.
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.
type ObjectType ¶
type ObjectType string
ObjectType represents objects that can have privileges.
const ( // Any represents any object type. Any ObjectType = "any" // Database represents a database object. Database ObjectType = "database" // Domain represents a domain object. Domain ObjectType = "domain" // Function represents a function object. Function ObjectType = "function" // Procedure represents a procedure object. Procedure ObjectType = "procedure" // ForeignDataWrapper represents a foreign data wrapper object. ForeignDataWrapper ObjectType = "foreign data wrapper" // ForeignServer represents a foreign server object. ForeignServer ObjectType = "foreign server" // Language represents a language object. Language ObjectType = "language" // LargeObject represents a large object object. LargeObject ObjectType = "large object" // Parameter represents a parameter object. Parameter ObjectType = "parameter" // Schema represents a schema object. Schema ObjectType = "schema" // Sequence represents a sequence object. Sequence ObjectType = "sequence" // Table represents a table object. Table ObjectType = "table" // Tablespace represents a tablespace object. Tablespace ObjectType = "tablespace" // Type represents a type object. Type ObjectType = "type" // Routine represents a routine object. Routine ObjectType = "routine" // it includes both functions and procedures )