Documentation ¶
Index ¶
- Constants
- Variables
- func BuildRunFlow(name string, input map[string]any) *runFlow
- func DoneArgs(name string, args ...any) resultI
- func DoneFlow(name string, input map[string]any) resultI
- func SetIdGenerator(method func() string)
- type FlowConfig
- type FlowController
- type FlowMeta
- type Future
- type Process
- type ProcessConfig
- func (pc *ProcessConfig) AfterProcess(must bool, callback func(*Process) (keepOn bool, err error)) *callback[*Process]
- func (pc *ProcessConfig) AfterStep(must bool, callback func(*Step) (keepOn bool, err error)) *callback[*Step]
- func (pc *ProcessConfig) BeforeProcess(must bool, callback func(*Process) (keepOn bool, err error)) *callback[*Process]
- func (pc *ProcessConfig) BeforeStep(must bool, callback func(*Step) (keepOn bool, err error)) *callback[*Step]
- func (pc *ProcessConfig) NotUseDefault()
- func (pc *ProcessConfig) ProcessTimeout(timeout time.Duration) *ProcessConfig
- func (pc *ProcessConfig) StepsRetry(retry int) *ProcessConfig
- func (pc *ProcessConfig) StepsTimeout(timeout time.Duration) *ProcessConfig
- type ProcessMeta
- func (pm *ProcessMeta) Merge(name string)
- func (pm *ProcessMeta) NameStep(run func(ctx StepCtx) (any, error), name string, depends ...any) *StepMeta
- func (pm *ProcessMeta) Step(run func(ctx StepCtx) (any, error), depends ...any) *StepMeta
- func (pm *ProcessMeta) Tail(run func(ctx StepCtx) (any, error), alias ...string) *StepMeta
- type Step
- type StepConfig
- type StepCtx
- type StepMeta
- func (meta *StepMeta) Next(run func(ctx StepCtx) (any, error), alias ...string) *StepMeta
- func (meta *StepMeta) Priority(priority map[string]any)
- func (meta *StepMeta) Retry(retry int) *StepMeta
- func (meta *StepMeta) Same(run func(ctx StepCtx) (any, error), alias ...string) *StepMeta
- func (meta *StepMeta) Timeout(timeout time.Duration) *StepMeta
- type WorkFlow
Constants ¶
const ( Before = "Before" After = "After" )
Variables ¶
var ( Pending = &statusEnum{0, "Pending"} Running = &statusEnum{0b1, "Running"} Pause = &statusEnum{0b1 << 1, "Pause"} Success = &statusEnum{0b1 << 15, "Success"} NormalMask = &statusEnum{0b1<<16 - 1, "NormalMask"} Cancel = &statusEnum{0b1 << 16, "Cancel"} Timeout = &statusEnum{0b1 << 17, "Timeout"} Panic = &statusEnum{0b1 << 18, "Panic"} Error = &statusEnum{0b1 << 19, "Error"} Stop = &statusEnum{0b1 << 20, "Stop"} CallbackFail = &statusEnum{0b1 << 21, "CallbackFail"} Failed = &statusEnum{0b1 << 31, "Failed"} // AbnormalMask An abnormal step status will cause the cancellation of dependent unexecuted steps. AbnormalMask = &statusEnum{NormalMask.flag << 16, "AbnormalMask"} )
these variable are used to indicate the status of the unit
Functions ¶
func BuildRunFlow ¶
func SetIdGenerator ¶
func SetIdGenerator(method func() string)
Types ¶
type FlowConfig ¶
type FlowConfig struct { ProcessConfig `flow:"skip"` // contains filtered or unexported fields }
func CreateDefaultConfig ¶
func CreateDefaultConfig() *FlowConfig
func (*FlowConfig) BeforeFlow ¶
type FlowController ¶
type FlowController interface { Done() []*Future ListProcess() []string ProcessController(name string) controller // contains filtered or unexported methods }
func AsyncArgs ¶
func AsyncArgs(name string, args ...any) FlowController
type FlowMeta ¶
type FlowMeta struct { FlowConfig // contains filtered or unexported fields }
func RegisterFlow ¶
func (*FlowMeta) NoUseDefault ¶
func (*FlowMeta) Process ¶
func (fm *FlowMeta) Process(name string) *ProcessMeta
type Future ¶
type Future struct {
// contains filtered or unexported fields
}
func (*Future) Done ¶
func (f *Future) Done()
Done method waits for the corresponding process to complete.
func (Future) Exceptions ¶ added in v0.0.5
func (s Future) Exceptions() []string
Exceptions return contain exception's message
func (Future) ExplainStatus ¶ added in v0.0.5
func (s Future) ExplainStatus() []string
ExplainStatus function explains the status represented by the provided bitmask. The function checks the status against predefined abnormal and normal flags, and returns a slice of strings containing the names of the matching flags. Parameter status is the bitmask representing the status. The returned slice contains the names of the matching flags in the layer they were found. If abnormal flags are found, normal flags will be ignored.
type Process ¶ added in v0.0.5
type Process struct { FlowId string // contains filtered or unexported fields }
func (*Process) ContextName ¶ added in v0.0.5
Fix ContextName return first step name
type ProcessConfig ¶
type ProcessConfig struct { StepConfig ProcTimeout time.Duration ProcNotUseDefault bool // contains filtered or unexported fields }
func (*ProcessConfig) AfterProcess ¶
func (*ProcessConfig) BeforeProcess ¶
func (*ProcessConfig) BeforeStep ¶
func (*ProcessConfig) NotUseDefault ¶
func (pc *ProcessConfig) NotUseDefault()
func (*ProcessConfig) ProcessTimeout ¶
func (pc *ProcessConfig) ProcessTimeout(timeout time.Duration) *ProcessConfig
func (*ProcessConfig) StepsRetry ¶
func (pc *ProcessConfig) StepsRetry(retry int) *ProcessConfig
func (*ProcessConfig) StepsTimeout ¶
func (pc *ProcessConfig) StepsTimeout(timeout time.Duration) *ProcessConfig
type ProcessMeta ¶
type ProcessMeta struct { ProcessConfig // contains filtered or unexported fields }
func (*ProcessMeta) Merge ¶
func (pm *ProcessMeta) Merge(name string)
Merge will not merge config, because has not effective design to not use merged config.