component: Rename and simplification

This commit is contained in:
Tom Wiesing 2022-10-18 09:17:25 +02:00
parent e320bb37bb
commit f7c8a43844
No known key found for this signature in database
26 changed files with 99 additions and 101 deletions

View file

@ -22,7 +22,7 @@ import (
)
// register returns all components of the distillery
func (dis *Distillery) register(context component.ComponentPoolContext) []component.Component {
func (dis *Distillery) register(context component.PoolContext) []component.Component {
return collection.MapSlice([]initFunc{
auto[*web.Web],
@ -65,16 +65,16 @@ func (dis *Distillery) register(context component.ComponentPoolContext) []compon
})
}
type initFunc = func(dis *Distillery, context component.ComponentPoolContext) component.Component
type initFunc = func(dis *Distillery, context component.PoolContext) component.Component
// manual initializes a component from the provided distillery.
func manual[C component.Component](init func(component C)) initFunc {
return func(dis *Distillery, context component.ComponentPoolContext) component.Component {
return component.MakeComponent(context, dis.Still, init)
return func(dis *Distillery, context component.PoolContext) component.Component {
return component.Make(context, dis.Still, init)
}
}
// use is like r, but does not provided additional initialization
func auto[C component.Component](dis *Distillery, context component.ComponentPoolContext) component.Component {
return component.MakeComponent[C](context, dis.Still, nil)
func auto[C component.Component](dis *Distillery, context component.PoolContext) component.Component {
return component.Make[C](context, dis.Still, nil)
}