inject

package
v0.0.0-...-27647ab Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvideAs

func ProvideAs[T any](i *Injector, tags ...any) T

func Type

func Type[T any]() reflect.Type

Types

type ArrayOf

type ArrayOf[T any] struct {
	Tag any
}

type BindArrayOf

type BindArrayOf[T any] struct {
	Tag any
}

type BindArraySliceOf

type BindArraySliceOf[T any] struct {
	Tag any
}

type Binder

type Binder = func() Bindings

type BinderRegistry

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

func NewBinderRegistry

func NewBinderRegistry() *BinderRegistry

func (*BinderRegistry) Bind

func (r *BinderRegistry) Bind() Bindings

func (*BinderRegistry) ForEach

func (r *BinderRegistry) ForEach(fn func(v Binding) bool) bool

func (*BinderRegistry) Register

func (r *BinderRegistry) Register(bs ...Binder) *BinderRegistry

func (*BinderRegistry) Seal

func (r *BinderRegistry) Seal() *BinderRegistry

type Binding

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

func As

func As(k, p any) Binding

type Bindings

type Bindings interface {
	bt.Traversable[Binding]
	// contains filtered or unexported methods
}

func Append

func Append(ps ...Bindings) Bindings

func Bind

func Bind(os ...any) Bindings

func Override

func Override(p Bindings, a ...any) Bindings

type Closer

type Closer interface {
	Close() error
}

type Const

type Const struct {
	Val any
}

type Debug

type Debug any

type Debugger

type Debugger interface {
	Debug() Debug
}

type DuplicateBindingError

type DuplicateBindingError struct {
	KeyError
}

func (DuplicateBindingError) Error

func (e DuplicateBindingError) Error() string

type DuplicateKeyError

type DuplicateKeyError struct {
	KeyError
}

func (DuplicateKeyError) Error

func (e DuplicateKeyError) Error() string

type EmptyArrayOf

type EmptyArrayOf[T any] struct{}

type Error

type Error interface {
	error
	// contains filtered or unexported methods
}

type Func

type Func struct {
	Fn any
}

type GenericError

type GenericError struct {
	Err error
}

func (GenericError) Error

func (e GenericError) Error() string

func (GenericError) Unwrap

func (e GenericError) Unwrap() error

type Injector

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

func NewDeferInjector

func NewDeferInjector(bs Bindings) (*Injector, func() error)

func NewInjector

func NewInjector(bs Bindings) *Injector

func (*Injector) ArgsProvider

func (i *Injector) ArgsProvider() rfl.ArgsProvider

func (*Injector) Bindings

func (i *Injector) Bindings() Bindings

func (*Injector) Debug

func (i *Injector) Debug() Debug

func (*Injector) Inject

func (i *Injector) Inject(fn any) []any

func (*Injector) InjectOne

func (i *Injector) InjectOne(fn any) any

func (*Injector) NewChild

func (i *Injector) NewChild(bs Bindings) *Injector

func (*Injector) Parent

func (i *Injector) Parent() *Injector

func (*Injector) Provide

func (i *Injector) Provide(o any) any

func (*Injector) ProvideArgs

func (i *Injector) ProvideArgs(fn any) []any

func (*Injector) TryProvide

func (i *Injector) TryProvide(o any) (any, bool)

type Key

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

func Array

func Array(o any) Key

func AsKey

func AsKey(o any) Key

func Tag

func Tag(o, tag any) Key

func (Key) String

func (k Key) String() string

type KeyError

type KeyError struct {
	Key Key

	Source any
	Name   string
}

func (KeyError) Error

func (e KeyError) Error() string

type KeyOf

type KeyOf[T any] struct {
	Tag any
}
type Link struct {
	To any
}

type Provider

type Provider interface {
	String() string
	// contains filtered or unexported methods
}

func Closing

func Closing(o any) Provider

type Singleton

type Singleton struct {
	Obj any
}

type UnboundKeyError

type UnboundKeyError struct {
	KeyError
}

func (UnboundKeyError) Error

func (e UnboundKeyError) Error() string

Jump to

Keyboard shortcuts

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