dscope

package module
v0.0.0-...-ddbaafb Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 13 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadArgument = errors.New("bad argument")
View Source
var ErrBadDefinition = errors.New("bad definition")
View Source
var ErrDependencyLoop = errors.New("dependency loop")
View Source
var ErrDependencyNotFound = errors.New("dependency not found")
View Source
var ErrNoValues = errors.New("no values")
View Source
var Universe = Scope{}

Functions

func Assign

func Assign[T any](scope Scope, ptr *T)

func Get

func Get[T any](scope Scope) (o T)

func Methods

func Methods(objects ...any) (ret []any)

func PtrTo

func PtrTo[T any](value T) *T

func Reduce

func Reduce(vs []reflect.Value) reflect.Value

Types

type CallResult

type CallResult struct {
	Values []reflect.Value
	// contains filtered or unexported fields
}

func (CallResult) Assign

func (c CallResult) Assign(targets ...any)

func (CallResult) Extract

func (c CallResult) Extract(targets ...any)

type CowMap

type CowMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewCowMap

func NewCowMap[K comparable, V any]() *CowMap[K, V]

func (*CowMap[K, V]) Get

func (c *CowMap[K, V]) Get(k K) (v V, ok bool)

func (*CowMap[K, V]) Set

func (c *CowMap[K, V]) Set(k K, v V)

type CustomReducer

type CustomReducer interface {
	Reduce(Scope, []reflect.Value) reflect.Value
}

type DebugInfo

type DebugInfo struct {
	Values map[reflect.Type]ValueDebugInfo
}

type Path

type Path struct {
	Prev   *Path
	TypeID _TypeID
}

func (Path) Error

func (p Path) Error() string

func (*Path) String

func (p *Path) String() string

type Reducer

type Reducer interface {
	IsReducer()
}

type Scope

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

func New

func New(
	defs ...any,
) Scope

func (Scope) Assign

func (scope Scope) Assign(objs ...any)

func (Scope) Call

func (scope Scope) Call(fn any) CallResult

func (Scope) CallValue

func (scope Scope) CallValue(fnValue reflect.Value) (res CallResult)

func (Scope) Fork

func (scope Scope) Fork(
	defs ...any,
) Scope

func (Scope) Get

func (scope Scope) Get(t reflect.Type) (
	ret reflect.Value,
	err error,
)

func (Scope) GetDebugInfo

func (s Scope) GetDebugInfo() (info DebugInfo)

type ValueDebugInfo

type ValueDebugInfo struct {
	DefTypes []reflect.Type
}

Jump to

Keyboard shortcuts

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