Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BcryptCost = bcrypt.DefaultCost
var ByName = map[string]Option{ "CREATEROLE": CREATEROLE, "NOCREATEROLE": NOCREATEROLE, "PASSWORD": PASSWORD, "LOGIN": LOGIN, "NOLOGIN": NOLOGIN, "VALID_UNTIL": VALIDUNTIL, }
ByName is a map of string -> kind value.
var ErrEmptyPassword = errors.New("empty passwords are not permitted")
ErrEmptyPassword indicates that an empty password was attempted to be set.
Functions ¶
func HashPassword ¶
HashPassword takes a raw password and returns a bcrypt hashed password.
Types ¶
type List ¶
type List []RoleOption
List is a list of role options.
func (List) CheckRoleOptionConflicts ¶
CheckRoleOptionConflicts returns an error if two or more options conflict with each other.
func (List) GetHashedPassword ¶
GetHashedPassword returns the value of the password after hashing it. Returns error if no password option is found or if password is invalid.
func (List) GetSQLStmts ¶
GetSQLStmts returns a map of SQL stmts to apply each role option. Maps stmts to values (value of the role option).
func (List) ToBitField ¶
ToBitField returns the bitfield representation of a list of role options.
type Option ¶
type Option uint32
Option defines a role option. This is output by the parser
const ( CREATEROLE Option NOCREATEROLE PASSWORD LOGIN NOLOGIN VALIDUNTIL )
KindList of role options.