model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CtxContext context key for custom context object
	CtxContext key = iota
	CtxUser
)

Variables

View Source
var ErrDuplicate = errors.New("duplicate record")

ErrDuplicate indicates duplicate key record

View Source
var ErrLogRestored = errors.New("already restored")

ErrLogRestored indicates conflict call for restoring usage by requestID

View Source
var ErrNoAccess = errors.New("no access")
View Source
var ErrNoRecord = errors.New("no record found")

ErrNoRecord indicates no record found error

View Source
var ErrOperationExists = errors.New("operation exists")

ErrOperationExists indicates existing operation for the record

View Source
var ErrUnauthorized = errors.New("unauthorized")

Functions

This section is empty.

Types

type NoAccessError

type NoAccessError struct {
	Resource string
}

func NewNoAccessError

func NewNoAccessError(resource, name string) *NoAccessError

func (*NoAccessError) Error

func (e *NoAccessError) Error() string

type User

type User struct {
	ID          string
	Name        string
	Disabled    bool
	MaxValidTo  time.Time
	MaxLimit    float64
	Projects    []string
	Permissions map[permission.Enum]bool
}

func (*User) HasPermission

func (u *User) HasPermission(perm permission.Enum) bool

func (*User) ValidateDate

func (u *User) ValidateDate(to *time.Time) (time.Time, error)

func (*User) ValidateID

func (u *User) ValidateID(id string) error

func (*User) ValidateProject

func (u *User) ValidateProject(p string) error

type WrongFieldError

type WrongFieldError struct {
	Field   string
	Message string
}

func NewWrongFieldError

func NewWrongFieldError(field, message string) *WrongFieldError

func (*WrongFieldError) Error

func (e *WrongFieldError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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