Documentation ¶
Index ¶
- Variables
- func Check(s interface{})
- func Execute(ctx context.Context, constructor Constructor[Application], ...)
- func Resolve(container, environment interface{})
- type App
- type AppOption
- type AppOptions
- type Application
- type ApplicationContextType
- type Builder
- type Constructor
- type Finalizer
- type Initializer
- type LogLevel
- type Option
- func UseDone[T Finalizer]() Option[T]
- func UseInit[T Initializer]() Option[T]
- func WithDone[T any](finalizer ...func(ctx context.Context, instance T)) Option[T]
- func WithInit[T any](initializer ...func(ctx context.Context, instance T) error) Option[T]
- func WithPriority[T any](priority int) Option[T]
- type Options
- type State
- type Variables
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger interface { Log(level LogLevel, component, msg string) } = new(logger)
Functions ¶
func Check ¶ added in v1.0.8
func Check(s interface{})
Check checks all fields of structure c for nil. It used reflection for this. If field is nil, then panic.
func Execute ¶ added in v1.0.17
func Execute( ctx context.Context, constructor Constructor[Application], options ...AppOption, )
func Resolve ¶ added in v1.0.7
func Resolve(container, environment interface{})
Resolve iterate by fields of structure environment and for each field search in the container constructor of component. If constructor found, then it calls and return value of constructor writes to the field of structure environment.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func GetAppFromContext ¶ added in v1.0.17
type AppOption ¶
type AppOption func(opts *AppOptions)
func WithConfigurator ¶ added in v1.0.30
func WithDaemon ¶ added in v1.0.3
func WithService ¶ added in v1.0.31
func WithService[T any](constructor ...Constructor[T]) AppOption
type AppOptions ¶
type AppOptions struct {
// contains filtered or unexported fields
}
type Application ¶ added in v1.0.17
type Application interface { Init(ctx context.Context) Done(ctx context.Context) Run(ctx context.Context) }
func Build ¶
func Build( ctx context.Context, constructor Constructor[Application], options ...AppOption, ) (a Application, c context.Context, err error)
type ApplicationContextType ¶ added in v1.0.17
type ApplicationContextType int
var ApplicationContextKey ApplicationContextType = 0
type Constructor ¶ added in v1.0.17
func NewComponent ¶
func NewComponent[T any]( name string, builder Builder[T], options ...Option[T], ) Constructor[T]
type Initializer ¶ added in v1.0.13
type Initializer interface {
Init() error
}
type Option ¶
func UseInit ¶ added in v1.0.14
func UseInit[T Initializer]() Option[T]
func WithPriority ¶ added in v1.0.15
type Variables ¶ added in v1.0.22
type Variables interface { Get(key string) interface{} GetInt(key string) int GetString(key string) string GetBool(key string) bool GetFloat(key string) float64 TryGet(key string, defVal interface{}) interface{} TryGetInt(key string, defVal int) int TryGetString(key string, defVal string) string TryGetBool(key string, defVal bool) bool TryGetFloat(key string, defVal float64) float64 Set(key string, val interface{}) SetInt(key string, val int) SetString(key string, val string) SetBool(key string, val bool) SetFloat(key string, val float64) }
func GetVariables ¶ added in v1.0.22
func NewVariables ¶ added in v1.0.22
Click to show internal directories.
Click to hide internal directories.