Documentation ¶
Index ¶
- Variables
- func Init()
- func Run(units ...Unit)
- func Terminate()
- type Assembly
- func (a *Assembly) Add(v ...Unit) error
- func (a *Assembly) Assemble(v interface{}) error
- func (a *Assembly) AssignableTo(t reflect.Type) (u []Unit)
- func (a *Assembly) Main() Unit
- func (a *Assembly) SelfAssemble() error
- func (a *Assembly) Units() []Unit
- func (a *Assembly) ValueTo(v interface{}) error
- type Depender
- type Initializer
- type PostInitializer
- type Runner
- type Service
- type Terminator
- type Unit
Constants ¶
This section is empty.
Variables ¶
var (
Identifier string
)
Functions ¶
Types ¶
type Assembly ¶
type Assembly struct {
// contains filtered or unexported fields
}
Assembly is a registry of related units.
func (*Assembly) Assemble ¶
Assemble will set any fields on v that match a type or interface in the assembly. It only sets fields that are exported and unset. If there is more than one match for a field, the first one is used. If the field is a slice, it will be populated with all the matches for the slice element type.
func (*Assembly) AssignableTo ¶
AssignableTo returns units that can be assigned to a value of the provided type. If the type is a slice/array, it returns units assignable to the element of the type.
func (*Assembly) Main ¶
Main returns the first registered unit in the assembly. If there are no units it returns nil.
func (*Assembly) SelfAssemble ¶
SelfAssemble runs AssembleTo on the assembly units.
type Initializer ¶
type Initializer interface {
Initialize()
}
Initializer provides an initialization hook after assembly.
type PostInitializer ¶
type PostInitializer interface {
PostInitialize()
}
PostInitializer provides a hook after initialization.
type Terminator ¶
type Terminator interface {
Terminate()
}