Documentation
¶
Index ¶
- func MsgLevel(lvl string) fwk.Level
- func NewJSONDecoder(r io.Reader) *json.Decoder
- func NewJSONEncoder(w io.Writer) *json.Encoder
- func Save(stmts []Stmt, enc Encoder) error
- type C
- type Decoder
- type Encoder
- type GoEncoder
- type Job
- func (job *Job) App() fwk.App
- func (job *Job) Create(cfg C) fwk.Component
- func (job *Job) Debugf(format string, a ...interface{})
- func (job *Job) Errorf(format string, a ...interface{})
- func (job *Job) Infof(format string, a ...interface{})
- func (job *Job) Run()
- func (job *Job) SetProp(c fwk.Component, name string, value interface{})
- func (job *Job) Stmts() []Stmt
- func (job *Job) UI() UI
- func (job *Job) Warnf(format string, a ...interface{})
- type P
- type Stmt
- type StmtType
- type UI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MsgLevel ¶
MsgLevel returns the fwk.Level according to the given lvl string value. MsgLevel panics if no fwk.Level value corresponds to the lvl string value. Valid values are: "DEBUG", "INFO", "WARNING"|"WARN" and "ERROR"|"ERR".
func NewJSONDecoder ¶
NewJSONDecoder returns a new decoder that reads from r.
func NewJSONEncoder ¶
NewJSONEncoder returns a new encoder that writes to w
Types ¶
type C ¶
type C struct { Name string // name of the fwk.Component to create (eg "my-propagator") Type string // type of the fwk.Component to create (eg "go-hep.org/x/hep/fads.Propagator") Props P // properties of the fwk.Component to create }
C describes the configuration data of a fwk.Component
type Decoder ¶
type Decoder interface {
Decode(ptr interface{}) error
}
Decoder decodes data from the unerlying io.Reader
type Encoder ¶
type Encoder interface {
Encode(data interface{}) error
}
Encoder encodes data into the underlying io.Writer
type GoEncoder ¶
type GoEncoder struct {
// contains filtered or unexported fields
}
A GoEncoder writes a go representation to an output stream
func NewGoEncoder ¶
NewGoEncoder returns a new encoder that writes to w
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job is the go-based scripting interface to create, configure and run a fwk.App.
func New ¶
New create a new Job with the default fwk.App implementation and configures it with the given properties P.
func NewJob ¶
NewJob create a new Job from the given fwk.App value and configures it with the given properties P.
func (*Job) Create ¶
Create creates a fwk.Component according to the configuration data held by cfg. Create panics if no such component was registered with fwk.
func (*Job) Run ¶
func (job *Job) Run()
Run runs the underlying fwk.App. Run panics if an error occurred during any of the execution stages of the application.
func (*Job) SetProp ¶
SetProp sets the property name of the component c with the value v. SetProp panics if the component does not have such property or if the types do not match.
type P ¶
type P map[string]interface{}
P holds the configuration data (the properties) of a fwk.Component a map of key-value pairs.
type Stmt ¶
type Stmt struct { Type StmtType // type of the statement Data C // the configuration data associated with that statement }
Stmt represents a job options statement.
type UI ¶
type UI struct {
// contains filtered or unexported fields
}
UI wraps a fwk.Scripter and panics when an error occurs
func (UI) Configure ¶
func (ui UI) Configure()
Configure configures the underlying fwk.App. Configure panics if an error occurs.
func (UI) Run ¶
Run runs the event-loop of the underlying fwk.App. Run panics if an error different than io.EOF occurs.
func (UI) Shutdown ¶
func (ui UI) Shutdown()
Shutdown shuts the underlying fwk.App down. Shutdown panics if an error occurs.