123456789101112131415161718192021222324252627282930 |
- package seq
- import "errors"
- type Tasker struct {
- seq map[string]*Seq
- }
- func NewTasker() *Tasker {
- return &Tasker{map[string]*Seq{}}
- }
- func (t *Tasker) Task(name string) *Seq {
- v, ok := t.seq[name]
- if !ok {
- v = NewSeq()
- t.seq[name] = v
- }
- return v
- }
- func (t *Tasker) Exec(name string, params ...interface{}) error {
- s, ok := t.seq[name]
- if !ok {
- return errors.New("Task Not found")
- }
- return s.Exec(params...)
- }
|