Versions in this module Expand all Collapse all v1 v1.0.4 Mar 26, 2020 Changes in this version + var ErrNotFound = errors.New("未找到流程相关的信息") + func FromExpContext(ctx context.Context) (expression.ExpContext, bool) + func FromFlagContext(ctx context.Context) (string, bool) + func GetNodeInstance(nodeInstanceID string) (*schema.NodeInstance, error) + func Init(opts ...db.Option) + func LoadFile(name string) error + func NewExpContext(ctx context.Context, exp expression.ExpContext) context.Context + func NewFlagContext(ctx context.Context, flag string) context.Context + func QueryDoneFlowIDs(flowCode, userID string) ([]string, error) + func QueryFlowHistory(flowInstanceID string) ([]*schema.FlowHistoryResult, error) + func QueryLastNodeInstance(flowInstanceID string) (*schema.NodeInstance, error) + func QueryNodeCandidates(nodeInstanceID string) ([]string, error) + func QueryTodoFlows(flowCode, userID string) ([]*schema.FlowTodoResult, error) + func QueryTodoFlowsPaginate(flowCode, userID string, page int, pageSize int) (int, []*schema.FlowTodoResult, error) + func SetExecer(execer Execer) + func SetParser(parser Parser) + func StartServer(opts ...ServerOption) http.Handler + func StopFlow(nodeInstanceID string, allowStop func(*schema.FlowInstance) bool) error + func StopFlowInstance(flowInstanceID string, allowStop func(*schema.FlowInstance) bool) error + type API struct + func (a *API) DeleteFlow(ctx *gear.Context) error + func (a *API) GetFlow(ctx *gear.Context) error + func (a *API) Init(engine *Engine) *API + func (a *API) QueryFlowPage(ctx *gear.Context) error + func (a *API) SaveFlow(ctx *gear.Context) error + type AutoCallbackHandler func(action, flag, userID string, input []byte, result *HandleResult) error + type EndHandle func(*schema.FlowInstance) + type Engine struct + func DefaultEngine() *Engine + func (e *Engine) CreateFlow(data []byte) (string, error) + func (e *Engine) FlowBll() *bll.Flow + func (e *Engine) GetNodeInstance(nodeInstanceID string) (*schema.NodeInstance, error) + func (e *Engine) HandleFlow(ctx context.Context, nodeInstanceID, userID string, inputData []byte) (*HandleResult, error) + func (e *Engine) Init(parser Parser, execer Execer, sqlDB *sql.DB, trace bool) (*Engine, error) + func (e *Engine) LaunchFlow(ctx context.Context, flowID, userID string, inputData []byte) (*HandleResult, error) + func (e *Engine) LoadFile(name string) error + func (e *Engine) QueryDoneFlowIDs(flowCode, userID string) ([]string, error) + func (e *Engine) QueryFlowHistory(flowInstanceID string) ([]*schema.FlowHistoryResult, error) + func (e *Engine) QueryLastNodeInstance(flowInstanceID string) (*schema.NodeInstance, error) + func (e *Engine) QueryNodeCandidates(nodeInstanceID string) ([]string, error) + func (e *Engine) QueryTodoFlows(flowCode, userID string) ([]*schema.FlowTodoResult, error) + func (e *Engine) QueryTodoFlowsPaginate(flowCode, userID string, page int, pageSize int) (int, []*schema.FlowTodoResult, error) + func (e *Engine) SetAutoCallback(callback AutoCallbackHandler) + func (e *Engine) SetExecer(execer Execer) + func (e *Engine) SetGetDBContext(fn func(flag string) context.Context) + func (e *Engine) SetLogger(logger Logger) + func (e *Engine) SetParser(parser Parser) + func (e *Engine) StartFlow(ctx context.Context, flowCode, nodeCode, userID string, inputData []byte) (*HandleResult, error) + func (e *Engine) StartTiming(interval time.Duration) + func (e *Engine) StopFlow(nodeInstanceID string, allowStop func(*schema.FlowInstance) bool) error + func (e *Engine) StopFlowInstance(flowInstanceID string, allowStop func(*schema.FlowInstance) bool) error + func (e *Engine) StopTiming() + type Execer interface + ExecReturnBool func(ctx context.Context, exp, params []byte) (bool, error) + ExecReturnStringSlice func(ctx context.Context, exp, params []byte) ([]string, error) + func NewQLangExecer() Execer + type FieldOption struct + ID string + Name string + type FieldProperty struct + ID string + Value string + type FieldValidation struct + Config string + Name string + type FormFieldResult struct + DefaultValue string + ID string + Label string + Properties []*FieldProperty + Type string + Validations []*FieldValidation + Values []*FieldOption + type HandleResult struct + FlowInstance *schema.FlowInstance + IsEnd bool + NextNodes []*NextNode + func HandleFlow(nodeInstanceID, userID string, input interface{}) (*HandleResult, error) + func HandleFlowWithContext(ctx context.Context, nodeInstanceID, userID string, input interface{}) (*HandleResult, error) + func StartFlow(flowCode, nodeCode, userID string, input interface{}) (*HandleResult, error) + func StartFlowWithContext(ctx context.Context, flowCode, nodeCode, userID string, input interface{}) (*HandleResult, error) + func (r *HandleResult) String() string + type Logger interface + Errorf func(format string, args ...interface{}) + type NextNode struct + CandidateIDs []string + Node *schema.Node + NodeInstance *schema.NodeInstance + type NextNodeHandle func(*schema.Node, *schema.NodeInstance, []*schema.NodeCandidate) + type NodeFormResult struct + Fields []*FormFieldResult + ID string + type NodeResult struct + CandidateExpressions []string + FormResult *NodeFormResult + NodeID string + NodeName string + NodeType NodeType + Properties []*PropertyResult + Routers []*RouterResult + type NodeRouter struct + func (n *NodeRouter) GetFlowInstance() *schema.FlowInstance + func (n *NodeRouter) Init(ctx context.Context, engine *Engine, nodeInstanceID string, inputData []byte, ...) (*NodeRouter, error) + func (n *NodeRouter) Next(processor string) error + type NodeRouterOption func(*nodeRouterOptions) + func AutoStartOption(autoStart bool) NodeRouterOption + func OnFlowEndOption(fn EndHandle) NodeRouterOption + func OnNextNodeOption(fn NextNodeHandle) NodeRouterOption + type NodeType string + const EndEvent + const ExclusiveGateway + const ParallelGateway + const StartEvent + const TerminateEvent + const Unknown + const UserTask + func GetNodeTypeByName(s string) (NodeType, error) + func (n NodeType) String() string + type ParseResult struct + FlowID string + FlowName string + FlowStatus int + FlowVersion int64 + Nodes []*NodeResult + type Parser interface + Parse func(ctx context.Context, data []byte) (*ParseResult, error) + func NewXMLParser() Parser + type PropertyResult struct + Name string + Value string + type Renderer interface + Render func(context.Context, *NodeFormResult) ([]byte, error) + func NewIonicRenderer() Renderer + type RouterResult struct + Explain string + Expression string + TargetNodeID string + type Server struct + func (a *Server) Init(engine *Engine, opts ...ServerOption) *Server + func (a *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ServerOption func(*serverOptions) + func ServerMiddlewareOption(middlewares ...gear.Middleware) ServerOption + func ServerPrefixOption(prefix string) ServerOption + func ServerStaticRootOption(staticRoot string) ServerOption