role

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package role represents the role type in the system.

Index

Constants

This section is empty.

Variables

View Source
var (
	Admin = newRole("ADMIN")
	User  = newRole("USER")
)

The set of roles that can be used.

Functions

func ParseToString

func ParseToString(usrRoles []Role) []string

ParseToString takes a collection of user roles and converts them to a slice of string.

Types

type Role

type Role struct {
	// contains filtered or unexported fields
}

Role represents a role in the system.

func MustParse

func MustParse(value string) Role

MustParse parses the string value and returns a role if one exists. If an error occurs the function panics.

func Parse

func Parse(value string) (Role, error)

Parse parses the string value and returns a role if one exists.

func ParseMany

func ParseMany(roles []string) ([]Role, error)

ParseMany takes a collection of strings and converts them to a slice of roles.

func (Role) Equal

func (r Role) Equal(r2 Role) bool

Equal provides support for the go-cmp package and testing.

func (Role) MarshalText

func (r Role) MarshalText() ([]byte, error)

MarshalText provides support for logging and any marshal needs.

func (Role) String

func (r Role) String() string

String returns the name of the role.

Jump to

Keyboard shortcuts

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