config

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(c Configuration, args []interface{}, targets ...interface{}) error

func RegisterActionMaker

func RegisterActionMaker(t ActionMaker, infoArgs string)

func RegisterConditionMaker

func RegisterConditionMaker(m ConditionMaker, infoArgs string)

func RegisteredActionMaker

func RegisteredActionMaker() (names []string)

RegisteredActionMaker returns the names of the registered action makers

func RegisteredActionMakerInfos

func RegisteredActionMakerInfos() (infos map[string]string)

RegisteredActionMakerInfos returns the infos of the registered action makers

func RegisteredConditionMaker

func RegisteredConditionMaker() (names []string)

RegisteredConditionMaker returns the names of the registered Condition makers

func RegisteredConditionMakerInfos

func RegisteredConditionMakerInfos() (infos map[string]string)

RegisteredConditionMakerInfos returns the infos of the registered Conditions makers

func ToInt

func ToInt(f interface{}) (val int, ok bool)

func ToInts

func ToInts(f interface{}) (val []int, ok bool)

Types

type Action

type Action struct {
	Name   string        `json="name"`   // the name of the action
	Make   string        `json="make"`   // make is a action maker and uses params
	Params []interface{} `json="params"` // parameters for the action maker
}

type ActionMaker

type ActionMaker interface {
	Name() string
	Action(c Configuration, args []interface{}) (midiline.Action, error)
}

type Condition

type Condition struct {
	Name   string        `json="name"`   // the name of the Condition
	Make   string        `json="make"`   // make is a Condition maker and uses params
	Params []interface{} `json="params"` // parameters for the Condition maker
}

type ConditionMaker

type ConditionMaker interface {
	Name() string
	Condition(c Configuration, args []interface{}) (midiline.Condition, error)
}

type Config

type Config struct {
	Conditions []Condition `json="conditions"`
	Actions    []Action    `json="actions"`
	Lines      []Line      `json="lines"`
}

func (*Config) Line

func (c *Config) Line(name string) (*midiline.Line, error)

type Configuration

type Configuration interface {
	FindCondition(name string) (midiline.Condition, error)
	FindAction(name string) (midiline.Action, error)
	FindLine(name string) (*midiline.Line, error)
}

type Line

type Line struct {
	Name  string `json="name"`
	Steps []Step `json="steps"`
}

the stack with the name "main" will be run

type Step

type Step struct {
	Condition string `json="condition"` // Condition is the name of the Condition, used by the step
	Action    string `json="action"`    // action is the name of a action
}

Step is a step in a Line. If the Condition is met, the action is performed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL