Documentation
¶
Index ¶
- Constants
- Variables
- func Get[T any](ctx *Context) T
- func GetAll[T any](ctx *Context) []T
- func GetNamed[T any](ctx *Context, name string) T
- type Context
- func (ctx *Context) GetAllByType(atype any) []any
- func (ctx *Context) GetAllByTypeOrErr(atype any) ([]any, *Error)
- func (ctx *Context) GetByType(atype any) any
- func (ctx *Context) GetByTypeOrErr(atype any) (any, *Error)
- func (ctx *Context) GetNamed(name string) any
- func (ctx *Context) GetNamedOrErr(name string) (any, *Error)
- func (ctx *Context) Initialize()
- func (ctx *Context) InitializeOrErr() *Error
- func (ctx *Context) Shutdown(context stdcontext.Context)
- func (ctx *Context) ShutdownOrErr(context stdcontext.Context) *Error
- type ContextBuilder
- func (ctxb *ContextBuilder) Add(ctor any)
- func (ctxb *ContextBuilder) AddAs(atype any, ctor any)
- func (ctxb *ContextBuilder) AddAsOrErr(atype any, ctor any) *Error
- func (ctxb *ContextBuilder) AddNamed(name string, ctor any)
- func (ctxb *ContextBuilder) AddNamedAs(name string, atype any, ctor any)
- func (ctxb *ContextBuilder) AddNamedAsOrErr(name string, atype any, ctor any) *Error
- func (ctxb *ContextBuilder) AddNamedOrErr(name string, ctor any) *Error
- func (ctxb *ContextBuilder) AddOrErr(ctor any) *Error
- func (ctxb *ContextBuilder) Build() *Context
- func (ctxb *ContextBuilder) Provide(ctor any)
- func (ctxb *ContextBuilder) ProvideAs(atype any, ctor any)
- func (ctxb *ContextBuilder) ProvideAsOrErr(atype any, ctor any) *Error
- func (ctxb *ContextBuilder) ProvideNamed(name string, ctor any)
- func (ctxb *ContextBuilder) ProvideNamedAs(name string, atype any, ctor any)
- func (ctxb *ContextBuilder) ProvideNamedAsOrErr(name string, atype any, ctor any) *Error
- func (ctxb *ContextBuilder) ProvideNamedOrErr(name string, ctor any) *Error
- func (ctxb *ContextBuilder) ProvideOrErr(ctor any) *Error
- type Error
- type Initializable
- type Shutdownable
Constants ¶
View Source
const ( ErrTypeDependencyCreation = iota ErrTypeDuplicatedName ErrTypeDuplicatedRegistration ErrTypeMissingDependency ErrTypeInvalidType ErrTypeInvalidConstructor ErrTypeCyclicDependency ErrTypeDependencyInitialization ErrTypeDependencyShutdown ErrTypeLifecycle )
Variables ¶
View Source
var ErrSkippedDependency = errors.New("skipped dependency")
Functions ¶
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) GetAllByType ¶
func (*Context) GetAllByTypeOrErr ¶
func (*Context) Initialize ¶ added in v0.0.5
func (ctx *Context) Initialize()
func (*Context) InitializeOrErr ¶ added in v0.0.5
func (*Context) Shutdown ¶ added in v0.0.5
func (ctx *Context) Shutdown(context stdcontext.Context)
func (*Context) ShutdownOrErr ¶ added in v0.0.5
func (ctx *Context) ShutdownOrErr(context stdcontext.Context) *Error
type ContextBuilder ¶
type ContextBuilder struct {
// contains filtered or unexported fields
}
func NewContextBuilder ¶
func NewContextBuilder() *ContextBuilder
func (*ContextBuilder) Add ¶
func (ctxb *ContextBuilder) Add(ctor any)
func (*ContextBuilder) AddAs ¶
func (ctxb *ContextBuilder) AddAs(atype any, ctor any)
func (*ContextBuilder) AddAsOrErr ¶
func (ctxb *ContextBuilder) AddAsOrErr(atype any, ctor any) *Error
func (*ContextBuilder) AddNamed ¶
func (ctxb *ContextBuilder) AddNamed(name string, ctor any)
func (*ContextBuilder) AddNamedAs ¶
func (ctxb *ContextBuilder) AddNamedAs(name string, atype any, ctor any)
func (*ContextBuilder) AddNamedAsOrErr ¶
func (ctxb *ContextBuilder) AddNamedAsOrErr(name string, atype any, ctor any) *Error
func (*ContextBuilder) AddNamedOrErr ¶
func (ctxb *ContextBuilder) AddNamedOrErr(name string, ctor any) *Error
func (*ContextBuilder) AddOrErr ¶
func (ctxb *ContextBuilder) AddOrErr(ctor any) *Error
func (*ContextBuilder) Build ¶
func (ctxb *ContextBuilder) Build() *Context
func (*ContextBuilder) Provide ¶ added in v0.0.3
func (ctxb *ContextBuilder) Provide(ctor any)
func (*ContextBuilder) ProvideAs ¶ added in v0.0.3
func (ctxb *ContextBuilder) ProvideAs(atype any, ctor any)
func (*ContextBuilder) ProvideAsOrErr ¶ added in v0.0.3
func (ctxb *ContextBuilder) ProvideAsOrErr(atype any, ctor any) *Error
func (*ContextBuilder) ProvideNamed ¶ added in v0.0.3
func (ctxb *ContextBuilder) ProvideNamed(name string, ctor any)
func (*ContextBuilder) ProvideNamedAs ¶ added in v0.0.3
func (ctxb *ContextBuilder) ProvideNamedAs(name string, atype any, ctor any)
func (*ContextBuilder) ProvideNamedAsOrErr ¶ added in v0.0.3
func (ctxb *ContextBuilder) ProvideNamedAsOrErr(name string, atype any, ctor any) *Error
func (*ContextBuilder) ProvideNamedOrErr ¶ added in v0.0.3
func (ctxb *ContextBuilder) ProvideNamedOrErr(name string, ctor any) *Error
func (*ContextBuilder) ProvideOrErr ¶ added in v0.0.3
func (ctxb *ContextBuilder) ProvideOrErr(ctor any) *Error
type Error ¶ added in v0.0.3
type Error struct {
// contains filtered or unexported fields
}
func GetAllOrErr ¶
type Initializable ¶ added in v0.0.5
type Initializable interface {
Initialize()
}
type Shutdownable ¶ added in v0.0.5
type Shutdownable interface {
Shutdown(context stdcontext.Context)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.