Documentation ¶
Index ¶
- Constants
- Variables
- func GetHistoryUserTaskList(ctx context.Context, flowInstanceID string) ([]*ent.FlowNodeInstance, error)
- func RegisterExecutor(eles ...*RegisterExecutorInput)
- type Executor
- type FlowCtx
- func (ctx *FlowCtx) CalculateNextNode(currentFlowElement *schema.FlowElement, instanceDataMap map[string]interface{}) *schema.FlowElement
- func (ctx *FlowCtx) GetUniqueNextNode(currentFlowElement *schema.FlowElement) *schema.FlowElement
- func (ctx *FlowCtx) SaveNodeInstanceList(nodeInstanceType int8) error
- type FlowElementInstance
- type RegisterExecutorInput
Constants ¶
View Source
const ( ProcessStatusDefault int8 = iota // 默认值 ProcessStatusSuccess // 已完成 ProcessStatusFailed // 已撤销 )
View Source
const ( FlowDefinitionStatusDefault int8 = iota // 数据库默认值 FlowDefinitionStatusInit // 流程创建, 初始化 FlowDefinitionStatusEditing // 编辑中 FlowDefinitionStatusDisabled // 已下线, 暂未使用 )
View Source
const ( FlowDeploymentStatusDefault int8 = iota // 数据库默认值 FlowDeploymentStatusDeployed // 已部署 FlowDeploymentStatusDisabled // 已下线, 暂未使用 )
View Source
const ( FlowInstanceStatusDefault int8 = iota // 数据库默认值 FlowInstanceStatusCompleted // 执行完成 FlowInstanceStatusRunning // 执行中 FlowInstanceStatusTerminated // 已终止 )
View Source
const ( FlowInstanceDataTypeDefault int8 = iota // 数据库默认值 FlowInstanceDataTypeInit // 实例初始化 FlowInstanceDataTypeExecute // 系统执行 FlowInstanceDataTypeHook // 系统主动获取 FlowInstanceDataTypeUpdate // 上游更新 FlowInstanceDataTypeCommit // 任务提交 FlowInstanceDataTypeRollback //任务回滚(暂时无用, 回滚时不产生新数据, 只修改数据版本号(dbId)) )
View Source
const ( FlowNodeInstanceStatusDefault int8 = iota // 数据库默认值 FlowNodeInstanceStatusCompleted // 处理成功 FlowNodeInstanceStatusActive // 处理中 FlowNodeInstanceStatusFailed // 处理失败 FlowNodeInstanceStatusDisabled // 处理已撤销 )
View Source
const ( FlowNodeInstanceTypeDetaul int8 = iota // 数据库默认值 FlowNodeInstanceTypeExecute // 系统执行 FlowNodeInstanceTypeCommit // 任务提交 FlowNodeInstanceTypeRollback // 任务撤销 )
View Source
const ( FlowElementFlowTypeSequenceFlow schema.FlowElementFlowType = "SequenceFlow" FlowElementFlowTypeStartEvent schema.FlowElementFlowType = "StartEvent" FlowElementFlowTypeEndEvent schema.FlowElementFlowType = "EndEvent" FlowElementFlowTypeUserTask schema.FlowElementFlowType = "UserTask" FlowElementFlowTypeExclusiveGateway schema.FlowElementFlowType = "ExclusiveGateway" )
View Source
const ( FlowElementPropertiesName = "name" FlowElementPropertiesCondition = "condition" )
Variables ¶
View Source
var ( // 流程定义错误 ErrCodeFlowNotExists = gcode.New(9101, "Flow not exist", nil) ErrCodeFlowNotEditing = gcode.New(9102, "Flow not editing status", nil) ErrCodeEmptyModel = gcode.New(9201, "Empty model", nil) ErrCodeStartNodeInvalid = gcode.New(9202, "Zero or more than one start node", nil) ErrCodeElementKeyNotUnique = gcode.New(9203, "Element key not unique", nil) ErrCodeEndNodeInvalid = gcode.New(9204, "No end node", nil) ErrCodeModelNotUnicom = gcode.New(9205, "Not unicom", nil) ErrCodeSequenceBelongToMultiPairNode = gcode.New(9206, "Sequence belong to multi pair node", nil) ErrCodeRingWrong = gcode.New(9207, "Ring wrong", nil) ErrCodeGatewayNoOutgoing = gcode.New(9208, "Gateway no outgoing", nil) ErrCodeEmptySequenceOutgoing = gcode.New(9209, "Empty sequence outgoing", nil) ErrCodeTooManyDefaultSequence = gcode.New(9210, "Too many default sequence", nil) ErrCodeModelUnknownElementKey = gcode.New(9211, "Unknown element key", nil) ErrCodeElementTooMuchIncoming = gcode.New(9212, "Too many incoming", nil) ErrCodeElementTooMuchOutgoing = gcode.New(9213, "Too many outgoing", nil) ErrCodeElementLackIncoming = gcode.New(9214, "Element lack incoming", nil) ErrCodeElementLackOutgoing = gcode.New(9215, "Element lack outgoing", nil) // 流程执行错误 ErrCodeCommitFailed = gcode.New(9501, "Commit task failed", nil) ErrCodeRollbackFailed = gcode.New(9502, "Rollback task failed", nil) ErrCodeCommitRejected = gcode.New(9503, "Commit rejected, flow is terminate", nil) ErrCodeRollbackRejected = gcode.New(9504, "Rollback rejected, non-running flowInstance to rollback", nil) ErrCodeNoNodeToRollback = gcode.New(9505, "No node to rollback", nil) ErrCodeNodeUserTaskToRollback = gcode.New(9506, "No userTask to rollback", nil) ErrCodeGetFlowDeploymentFailed = gcode.New(9507, "Get flowDeployment failed", nil) ErrCodeGetFlowInstanceFailed = gcode.New(9508, "Get flowInstance failed", nil) ErrCodeGetNodeFailed = gcode.New(9509, "Get current node failed", nil) ErrCodeGetNodeInstanceFailed = gcode.New(9510, "Get nodeInstance failed", nil) ErrCodeGetInstanceDataFailed = gcode.New(9511, "Get instanceData failed", nil) ErrCodeGetHookConfigFaield = gcode.New(9512, "Get hook config failed", nil) ErrCodeGetOutgoingFailed = gcode.New(9513, "Get outgoing failed", nil) ErrCodeUnsupportElementType = gcode.New(9514, "Unsupported element type", nil) ErrCodeUnsupportElementFlowType = gcode.New(9515, "Unsupported element flow type", nil) ErrCodeMissingData = gcode.New(9516, "Miss data", nil) ErrCodeSaveFlowInstanceFailed = gcode.New(9517, "Save flowInstance failed", nil) ErrCodeSaveInstanceDataFailed = gcode.New(9518, "Save instanceData failed", nil) ErrCodeSaveNodeInstanceListFailed = gcode.New(9519, "Save nodeInstanceList failed", nil) ErrCodeSaveNodeInstanceLogListFailed = gcode.New(9520, "Save nodeInstanceLogList failed", nil) ErrCodeExpressionCalculateFailed = gcode.New(9521, "Expression calculate failed", nil) )
Functions ¶
func GetHistoryUserTaskList ¶
func RegisterExecutor ¶
func RegisterExecutor(eles ...*RegisterExecutorInput)
Types ¶
type Executor ¶
type Executor interface { Validate(eleMap map[string]*schema.FlowElement, ele *schema.FlowElement) error Execute(ctx *FlowCtx) error Commit(ctx *FlowCtx) error Rollback(ctx *FlowCtx) error IsCompleted(ctx *FlowCtx) bool GetExecuteExecutor(ctx *FlowCtx) Executor GetRollbackExecutor(ctx *FlowCtx) (Executor, error) }
func GetElementExecutor ¶
type FlowCtx ¶
type FlowCtx struct { Ctx context.Context FlowElementMap map[string]*schema.FlowElement FlowInstanceID string FlowInstanceStatus int8 SuspendNodeInstance *ent.FlowNodeInstance NodeInstanceList []ent.FlowNodeInstance CurrentNodeModel *schema.FlowElement CurrentNodeInstance *ent.FlowNodeInstance InstanceDataID string InstanceDataMap map[string]interface{} ProcessStatus int8 }
func (*FlowCtx) CalculateNextNode ¶
func (ctx *FlowCtx) CalculateNextNode(currentFlowElement *schema.FlowElement, instanceDataMap map[string]interface{}) *schema.FlowElement
func (*FlowCtx) GetUniqueNextNode ¶
func (ctx *FlowCtx) GetUniqueNextNode(currentFlowElement *schema.FlowElement) *schema.FlowElement
func (*FlowCtx) SaveNodeInstanceList ¶
type FlowElementInstance ¶
type FlowElementInstance struct { NodeKey string `json:"node_key"` NodeName string `json:"node_name"` Status int8 `json:"status"` }
func GetHistoryElementList ¶
func GetHistoryElementList(ctx context.Context, flowInstanceID string) ([]*FlowElementInstance, error)
type RegisterExecutorInput ¶
Click to show internal directories.
Click to hide internal directories.