roleoption

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ByName = map[string]Option{
	"CREATEROLE":             CREATEROLE,
	"NOCREATEROLE":           NOCREATEROLE,
	"PASSWORD":               PASSWORD,
	"LOGIN":                  LOGIN,
	"NOLOGIN":                NOLOGIN,
	"VALID UNTIL":            VALIDUNTIL,
	"CONTROLJOB":             CONTROLJOB,
	"NOCONTROLJOB":           NOCONTROLJOB,
	"CONTROLCHANGEFEED":      CONTROLCHANGEFEED,
	"NOCONTROLCHANGEFEED":    NOCONTROLCHANGEFEED,
	"CREATEDB":               CREATEDB,
	"NOCREATEDB":             NOCREATEDB,
	"CREATELOGIN":            CREATELOGIN,
	"NOCREATELOGIN":          NOCREATELOGIN,
	"VIEWACTIVITY":           VIEWACTIVITY,
	"NOVIEWACTIVITY":         NOVIEWACTIVITY,
	"CANCELQUERY":            CANCELQUERY,
	"NOCANCELQUERY":          NOCANCELQUERY,
	"MODIFYCLUSTERSETTING":   MODIFYCLUSTERSETTING,
	"NOMODIFYCLUSTERSETTING": NOMODIFYCLUSTERSETTING,
	"DEFAULTSETTINGS":        DEFAULTSETTINGS,
	"VIEWACTIVITYREDACTED":   VIEWACTIVITYREDACTED,
	"NOVIEWACTIVITYREDACTED": NOVIEWACTIVITYREDACTED,
	"SQLLOGIN":               SQLLOGIN,
	"NOSQLLOGIN":             NOSQLLOGIN,
	"VIEWCLUSTERSETTING":     VIEWCLUSTERSETTING,
	"NOVIEWCLUSTERSETTING":   NOVIEWCLUSTERSETTING,
}

ByName is a map of string -> kind value.

Functions

This section is empty.

Types

type List

type List []RoleOption

List is a list of role options.

func (List) CheckRoleOptionConflicts

func (rol List) CheckRoleOptionConflicts() error

CheckRoleOptionConflicts returns an error if two or more options conflict with each other.

func (List) Contains

func (rol List) Contains(p Option) bool

Contains returns true if List contains option, false otherwise.

func (List) GetPassword

func (rol List) GetPassword() (isNull bool, password string, err error)

GetPassword returns the value of the password or whether the password was set to NULL. Returns error if the string was invalid or if no password option is found.

func (List) GetSQLStmts

func (rol List) GetSQLStmts(op string) (map[string]func() (bool, string, error), error)

GetSQLStmts returns a map of SQL stmts to apply each role option. Maps stmts to values (value of the role option).

func (List) ToBitField

func (rol List) ToBitField() (uint32, error)

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 // VALID UNTIL
	CONTROLJOB
	NOCONTROLJOB
	CONTROLCHANGEFEED
	NOCONTROLCHANGEFEED
	CREATEDB
	NOCREATEDB
	CREATELOGIN
	NOCREATELOGIN
	VIEWACTIVITY
	NOVIEWACTIVITY
	CANCELQUERY
	NOCANCELQUERY
	MODIFYCLUSTERSETTING
	NOMODIFYCLUSTERSETTING
	DEFAULTSETTINGS
	VIEWACTIVITYREDACTED
	NOVIEWACTIVITYREDACTED
	SQLLOGIN
	NOSQLLOGIN
	VIEWCLUSTERSETTING
	NOVIEWCLUSTERSETTING
)

KindList of role options.

func ToOption

func ToOption(str string) (Option, error)

ToOption takes a string and returns the corresponding Option.

func (Option) Mask

func (o Option) Mask() uint32

Mask returns the bitmask for a given role option.

func (Option) String

func (i Option) String() string

type RoleOption

type RoleOption struct {
	Option
	HasValue bool
	// Need to resolve value in Exec for the case of placeholders.
	Value func() (bool, string, error)
}

RoleOption represents an Option with a value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL