scope

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrScopeInvalid = errors.New("scope is invalid")
)

Functions

func DefineAction

func DefineAction[A any]() (A, map[string]Actioner)

func DefineResource

func DefineResource[T any]() (T, map[string]Resourcer)

Types

type Actioner

type Actioner interface {
	String() string
	IsSubset(Actioner) bool
	// contains filtered or unexported methods
}

type BaseAction

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

func (BaseAction) IsSubset

func (action BaseAction) IsSubset(another Actioner) bool

func (BaseAction) String

func (action BaseAction) String() string

type BaseResource

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

func (BaseResource) IsSubset

func (resource BaseResource) IsSubset(another Resourcer) bool

func (BaseResource) String

func (resource BaseResource) String() string

type Engine

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

func NewEngine

func NewEngine(actionMap map[string]Actioner, resourceMap map[string]Resourcer) Engine

func (Engine) ParseScope

func (engine Engine) ParseScope(s string) Scoper

func (Engine) ParseScopes

func (engine Engine) ParseScopes(s string) Scopes

type Resourcer

type Resourcer interface {
	String() string
	IsSubset(Resourcer) bool
}

type Scope

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

func New

func New(action Actioner, resource Resourcer) Scope

func (Scope) AsScopes

func (scope Scope) AsScopes() Scopes

func (Scope) Contains

func (scope Scope) Contains(another Scoper) bool

func (Scope) IsUndefined

func (scope Scope) IsUndefined() bool

func (Scope) String

func (scope Scope) String() string

type Scoper

type Scoper interface {
	Contains(another Scoper) bool

	String() string

	IsUndefined() bool
}

type Scopes

type Scopes []Scoper

func NewScopes

func NewScopes(scopes ...Scoper) Scopes

func (Scopes) Contains

func (scopes Scopes) Contains(target Scope) bool

func (Scopes) Intersect

func (scopes Scopes) Intersect(another Scopes) Scopes

func (Scopes) LessThan

func (scopes Scopes) LessThan(another Scopes) bool

func (Scopes) String

func (scopes Scopes) String() string

type Stringer

type Stringer interface {
	String() string
}

type UndefinedScope

type UndefinedScope string

func (UndefinedScope) Contains

func (scope UndefinedScope) Contains(another Scoper) bool

func (UndefinedScope) IsUndefined

func (scope UndefinedScope) IsUndefined() bool

func (UndefinedScope) String

func (scope UndefinedScope) String() string

Jump to

Keyboard shortcuts

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