Documentation ¶
Index ¶
- Variables
- type Action
- func (action *Action) GetNext(k interface{}) IExecutor
- func (action *Action) GetScriptLines() []ScriptLine
- func (action *Action) GetState() ExecutorState
- func (action *Action) Run(ctx context.Context, signalControl chan ActionControl, varPool VarPool) ([]interface{}, error)
- func (action *Action) SetNext(k interface{}, exec IExecutor)
- type ActionAdd
- type ActionBreak
- type ActionContinue
- type ActionControl
- type ActionDeclare
- type ActionJson
- type ActionPrint
- type ActionPrintf
- type ActionReturn
- type ActionSleep
- type ActionTree
- type BFeedbackReporter
- type ExecutorState
- type ExprJson
- type Expression
- type Feedback
- type FeedbackType
- type IAction
- func MakeAdd(reporter *BFeedbackReporter, x, y int) (IAction, error)
- func MakeBreak(reporter *BFeedbackReporter) (IAction, error)
- func MakeContinue(reporter *BFeedbackReporter) (IAction, error)
- func MakeDeclare(reporter *BFeedbackReporter, value interface{}) (IAction, error)
- func MakePrint(reporter *BFeedbackReporter, args []interface{}) (IAction, error)
- func MakePrintf(reporter *BFeedbackReporter, format string, args []interface{}) (IAction, error)
- func MakeReturn(reporter *BFeedbackReporter) (IAction, error)
- func MakeSleep(reporter *BFeedbackReporter, seconds float64) (IAction, error)
- type ICycleExpr
- type IExecutor
- type IExpr
- type Inputs
- type Outputs
- type Parser
- type ScriptLine
- type StatementJson
- type StatementType
- type TaskJson
- type TaskRunner
- type VarPool
- func (pool *VarPool) Add(key string, value interface{})
- func (pool *VarPool) MakeInput(inputs ...interface{}) ([]interface{}, error)
- func (pool *VarPool) Merge(another VarPool)
- func (pool *VarPool) SaveOutputs(keys []string, value ...interface{}) error
- func (pool *VarPool) String() string
- func (pool *VarPool) Summary(another VarPool)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFactory = map[string]any{ "declare": MakeDeclare, "return": MakeReturn, "continue": MakeContinue, "break": MakeBreak, "printf": MakePrintf, "print": MakePrint, "sleep": MakeSleep, "add": MakeAdd, }
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
func (*Action) GetScriptLines ¶
func (action *Action) GetScriptLines() []ScriptLine
func (*Action) GetState ¶
func (action *Action) GetState() ExecutorState
func (*Action) Run ¶
type ActionAdd ¶
type ActionAdd struct { *BFeedbackReporter // contains filtered or unexported fields }
type ActionBreak ¶
type ActionBreak struct {
*BFeedbackReporter
}
func (*ActionBreak) Continue ¶
func (s *ActionBreak) Continue() error
func (*ActionBreak) Pause ¶
func (s *ActionBreak) Pause() error
func (*ActionBreak) Start ¶
func (s *ActionBreak) Start() error
func (*ActionBreak) Stop ¶
func (s *ActionBreak) Stop() error
type ActionContinue ¶
type ActionContinue struct {
*BFeedbackReporter
}
func (*ActionContinue) Continue ¶
func (s *ActionContinue) Continue() error
func (*ActionContinue) Pause ¶
func (s *ActionContinue) Pause() error
func (*ActionContinue) Start ¶
func (s *ActionContinue) Start() error
func (*ActionContinue) Stop ¶
func (s *ActionContinue) Stop() error
type ActionControl ¶
type ActionControl uint8
const ( ActionControlPause ActionControl = iota + 1 ActionControlContinue ActionControlStop )
func (ActionControl) String ¶
func (t ActionControl) String() string
type ActionDeclare ¶
type ActionDeclare struct { *BFeedbackReporter // contains filtered or unexported fields }
func (*ActionDeclare) Continue ¶
func (s *ActionDeclare) Continue() error
func (*ActionDeclare) Pause ¶
func (s *ActionDeclare) Pause() error
func (*ActionDeclare) Start ¶
func (s *ActionDeclare) Start() error
func (*ActionDeclare) Stop ¶
func (s *ActionDeclare) Stop() error
type ActionJson ¶
type ActionPrint ¶
type ActionPrint struct { *BFeedbackReporter // contains filtered or unexported fields }
func (*ActionPrint) Continue ¶
func (s *ActionPrint) Continue() error
func (*ActionPrint) Pause ¶
func (s *ActionPrint) Pause() error
func (*ActionPrint) Start ¶
func (s *ActionPrint) Start() error
func (*ActionPrint) Stop ¶
func (s *ActionPrint) Stop() error
type ActionPrintf ¶
type ActionPrintf struct { *BFeedbackReporter // contains filtered or unexported fields }
func (*ActionPrintf) Continue ¶
func (s *ActionPrintf) Continue() error
func (*ActionPrintf) Pause ¶
func (s *ActionPrintf) Pause() error
func (*ActionPrintf) Start ¶
func (s *ActionPrintf) Start() error
func (*ActionPrintf) Stop ¶
func (s *ActionPrintf) Stop() error
type ActionReturn ¶
type ActionReturn struct {
*BFeedbackReporter
}
func (*ActionReturn) Continue ¶
func (s *ActionReturn) Continue() error
func (*ActionReturn) Pause ¶
func (s *ActionReturn) Pause() error
func (*ActionReturn) Start ¶
func (s *ActionReturn) Start() error
func (*ActionReturn) Stop ¶
func (s *ActionReturn) Stop() error
type ActionSleep ¶
type ActionSleep struct { *BFeedbackReporter // contains filtered or unexported fields }
func (*ActionSleep) Continue ¶
func (s *ActionSleep) Continue() error
func (*ActionSleep) Pause ¶
func (s *ActionSleep) Pause() error
func (*ActionSleep) Start ¶
func (s *ActionSleep) Start() error
func (*ActionSleep) Stop ¶
func (s *ActionSleep) Stop() error
type ActionTree ¶
type ActionTree struct {
// contains filtered or unexported fields
}
func (ActionTree) GetScriptLines ¶
func (tree ActionTree) GetScriptLines() []ScriptLine
func (ActionTree) String ¶
func (tree ActionTree) String() string
type BFeedbackReporter ¶
type BFeedbackReporter struct {
// contains filtered or unexported fields
}
func (BFeedbackReporter) Complete ¶
func (r BFeedbackReporter) Complete(returns ...interface{})
func (BFeedbackReporter) Feedback ¶
func (r BFeedbackReporter) Feedback(t FeedbackType, returns []interface{}, err error)
func (BFeedbackReporter) FeedbackNoContent ¶
func (r BFeedbackReporter) FeedbackNoContent(t FeedbackType)
type ExecutorState ¶
type ExecutorState uint8
const ( ExecutorStateIdle ExecutorState = iota //空闲 ExecutorStateRunning //运行中 ExecutorStatePausing //暂停中 ExecutorStatePaused //已暂停 ExecutorStateContinuing //继续中 ExecutorStateStopping //停止中 ExecutorStateStopped //停止中 ExecutorStateComplete //执行完成 ExecutorStateError //出粗 )
func (ExecutorState) String ¶
func (state ExecutorState) String() string
type ExprJson ¶
type ExprJson struct { Condition interface{} `json:"condition" binding:"required"` SubSteps map[string][]StatementJson `json:"sub_steps" binding:"required"` }
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
func (*Expression) Do ¶
func (expr *Expression) Do(varPool VarPool) (interface{}, bool, error)
func (*Expression) GetNext ¶
func (expr *Expression) GetNext(k interface{}) IExecutor
func (*Expression) GetScriptLines ¶
func (expr *Expression) GetScriptLines() []ScriptLine
func (*Expression) GetState ¶
func (expr *Expression) GetState() ExecutorState
func (*Expression) SetNext ¶
func (expr *Expression) SetNext(k interface{}, exec IExecutor)
type Feedback ¶
type Feedback struct {
// contains filtered or unexported fields
}
type FeedbackType ¶
type FeedbackType uint8
const ( FBStartSuccess FeedbackType = iota //启动成功 FBPauseSuccess //暂停成功 FBContinueSuccess //继续成功 FBStopSuccess //停止成功 FBComplete //运行完成 FBRunningError //运行出错 )
func (FeedbackType) String ¶
func (t FeedbackType) String() string
type IAction ¶
func MakeAdd ¶
func MakeAdd(reporter *BFeedbackReporter, x, y int) (IAction, error)
func MakeBreak ¶
func MakeBreak(reporter *BFeedbackReporter) (IAction, error)
func MakeContinue ¶
func MakeContinue(reporter *BFeedbackReporter) (IAction, error)
func MakeDeclare ¶
func MakeDeclare(reporter *BFeedbackReporter, value interface{}) (IAction, error)
func MakePrint ¶
func MakePrint(reporter *BFeedbackReporter, args []interface{}) (IAction, error)
func MakePrintf ¶
func MakePrintf(reporter *BFeedbackReporter, format string, args []interface{}) (IAction, error)
func MakeReturn ¶
func MakeReturn(reporter *BFeedbackReporter) (IAction, error)
func MakeSleep ¶
func MakeSleep(reporter *BFeedbackReporter, seconds float64) (IAction, error)
type ICycleExpr ¶
type ICycleExpr interface {
CycleExpr()
}
type IExecutor ¶
type IExecutor interface { SetNext(k interface{}, exec IExecutor) GetNext(k interface{}) IExecutor GetState() ExecutorState GetScriptLines() []ScriptLine }
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (Parser) Parse ¶
func (p Parser) Parse(data []byte) (*ActionTree, error)
type ScriptLine ¶
type ScriptLine struct {
// contains filtered or unexported fields
}
type StatementJson ¶
type StatementJson struct { Name string `json:"name" binding:"required"` Type StatementType `json:"type"` Retry int `json:"retry"` Params djson.Raw `json:"params" binding:"required"` }
type StatementType ¶
type StatementType uint8
const ( StatementAction StatementType = iota StatementExpr )
type TaskJson ¶
type TaskJson struct { Name string `json:"name" binding:"required"` Statements []StatementJson `json:"statements" binding:"required"` }
type TaskRunner ¶
type TaskRunner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(actionTree *ActionTree) *TaskRunner
func (*TaskRunner) Continue ¶
func (runner *TaskRunner) Continue() error
func (*TaskRunner) GetScript ¶
func (runner *TaskRunner) GetScript() string
func (*TaskRunner) Pause ¶
func (runner *TaskRunner) Pause() error
func (*TaskRunner) Print ¶
func (runner *TaskRunner) Print()
func (*TaskRunner) Start ¶
func (runner *TaskRunner) Start() error
func (*TaskRunner) Stop ¶
func (runner *TaskRunner) Stop() error
Click to show internal directories.
Click to hide internal directories.