Documentation ¶
Index ¶
- Variables
- type Function
- type Generator
- type GeneratorRegistry
- func (ng *GeneratorRegistry) CreateFromBytes(id string, config []byte) (Op, error)
- func (ng *GeneratorRegistry) CreateWithJSON(id string, config interface{}) (Op, error)
- func (ng *GeneratorRegistry) CreateWithTOML(id string, config interface{}) (Op, error)
- func (ng *GeneratorRegistry) MustCreateFromBytes(id string, config []byte) Op
- func (ng *GeneratorRegistry) Register(id string, fun Generator) bool
- func (ng *GeneratorRegistry) RegisterJSON(id string, fun Function) bool
- func (ng *GeneratorRegistry) RegisterTOML(id string, fun Function) bool
- type MultiRunner
- type Op
Constants ¶
This section is empty.
Variables ¶
var (
ErrFunctionNotFound = errors.New("Function with given id not found")
)
errors.
Functions ¶
This section is empty.
Types ¶
type Function ¶
type Function func() Op
Function defines a interface for a function which returns a giving Op.
type GeneratorRegistry ¶
type GeneratorRegistry struct {
// contains filtered or unexported fields
}
GeneratorRegistry implements a structure that handles registration and ochestration of spells.
func NewGeneratorRegistry ¶
func NewGeneratorRegistry() *GeneratorRegistry
NewGeneratorRegistry returns a new instance of the GeneratorsRegistry.
func (*GeneratorRegistry) CreateFromBytes ¶
func (ng *GeneratorRegistry) CreateFromBytes(id string, config []byte) (Op, error)
CreateFromBytes returns a new spell from the provided configuration
func (*GeneratorRegistry) CreateWithJSON ¶
func (ng *GeneratorRegistry) CreateWithJSON(id string, config interface{}) (Op, error)
CreateWithJSON returns a new spell from the provided configuration map which is first converted into JSON then loaded using the CreateFromBytes function.
func (*GeneratorRegistry) CreateWithTOML ¶
func (ng *GeneratorRegistry) CreateWithTOML(id string, config interface{}) (Op, error)
CreateWithTOML returns a new spell from the provided configuration map which is first converted into JSON then loaded using the CreateFromBytes function.
func (*GeneratorRegistry) MustCreateFromBytes ¶
func (ng *GeneratorRegistry) MustCreateFromBytes(id string, config []byte) Op
MustCreateFromBytes panics if giving function for id is not found.
func (*GeneratorRegistry) Register ¶
func (ng *GeneratorRegistry) Register(id string, fun Generator) bool
Register adds the giving function into the list of available functions for instanction.
func (*GeneratorRegistry) RegisterJSON ¶
func (ng *GeneratorRegistry) RegisterJSON(id string, fun Function) bool
RegisterJSON adds the giving function into the list of available functions for instanction, where it's config would be loaded using json as the config unmarshaller.
func (*GeneratorRegistry) RegisterTOML ¶
func (ng *GeneratorRegistry) RegisterTOML(id string, fun Function) bool
RegisterTOML adds the giving function into the list of available functions for instanction, where it's config would be loaded using toml as the config unmarshaller.
type MultiRunner ¶
MultiRunner will run necessary commands to update apt-get for a debian/ubuntu system.