rank

package
Version: v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagUser       = "user"
	TagUserPrefix = "usr"
	TagBanPrefix  = "ban"
	TagModPrefix  = "mod"
	TagAdmin      = "admin"
	TagSystem     = "system"
)

Tags for user rank

Variables

This section is empty.

Functions

This section is empty.

Types

type Rank

type Rank map[string]struct{}

Rank represents the set of all user auth tags

func Admin

func Admin() Rank

Admin creates a new Administrator rank

func BaseUser

func BaseUser() Rank

BaseUser creates a new user rank

func FromSlice

func FromSlice(rankSlice []string) Rank

FromSlice creates a new Rank from a list of strings

func FromStringGroup

func FromStringGroup(rankString string) (Rank, error)

FromStringGroup creates a new Group Rank from a string

func FromStringUser

func FromStringUser(rankString string) (Rank, error)

FromStringUser creates a new User Rank from a string

func System

func System() Rank

System creates a new System rank

func (Rank) Add

func (r Rank) Add(other Rank)

Add adds a rank

func (Rank) AddBan added in v0.2.5

func (r Rank) AddBan(tag string) Rank

AddBan adds a ban tag

func (Rank) AddMod added in v0.2.5

func (r Rank) AddMod(tag string) Rank

AddMod adds a mod tag

func (Rank) AddOne added in v0.2.5

func (r Rank) AddOne(tag string) Rank

AddOne adds a tag

func (Rank) AddUser added in v0.2.5

func (r Rank) AddUser(tag string) Rank

AddUser adds a user tag

func (Rank) Has

func (r Rank) Has(tag string) bool

Has checks if a Rank has a tag

func (Rank) HasBan

func (r Rank) HasBan(tag string) bool

HasBan checks if a Rank has a ban tag

func (Rank) HasMod

func (r Rank) HasMod(tag string) bool

HasMod checks if a Rank has a moderator tag

func (Rank) HasUser

func (r Rank) HasUser(tag string) bool

HasUser checks if a Rank has a user tag

func (Rank) Intersect added in v0.2.5

func (r Rank) Intersect(other Rank) Rank

Intersect returns the intersection between Ranks

func (Rank) Len added in v0.2.5

func (r Rank) Len() int

Len returns the size of the rank

func (Rank) Remove

func (r Rank) Remove(other Rank)

Remove removes a rank

func (Rank) Stringify

func (r Rank) Stringify() string

Stringify transforms the rank into an alphabetically ordered, comma delimited string

func (Rank) ToSlice

func (r Rank) ToSlice() []string

ToSlice returns an alphabetically sorted string slice of the rank

Source Files

Jump to

Keyboard shortcuts

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