MCPcopy Index your code
hub / github.com/antlinker/flow

github.com/antlinker/flow @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
816 symbols 4,071 edges 47 files 211 documented · 26%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

工作流引擎

工作流设计器

获取项目

cd $GOPATH/src
git clone https://gogs.xiaoyuanjijiehao.com/antlinker/flow.git ant-flow
cd ant-flow
go install -v ./...

使用

1. 初始化工作流引擎

import (
    "time"

    "ant-flow"
    "ant-flow/service/db"
    _ "github.com/go-sql-driver/mysql"
)

func main() {
    flow.Init(
        db.SetDSN("root:123456@tcp(127.0.0.1:3306)/flows?charset=utf8"),
        db.SetTrace(true),
    )
}

2. 加载工作流文件

    err := flow.LoadFile("leave.bpmn")
    if err != nil {
        // 处理错误
    }

3. 发起流程

  input := map[string]interface{}{
    "day": 1,
  }

    result, err := flow.StartFlow("流程编号", "开始节点编号", "流程发起人ID", input)
    if err != nil {
        // 处理错误
    }

4. 查询待办流程列表

    todos, err := flow.QueryTodoFlows("流程编号", "流程待办人ID")
    if err != nil {
        // 处理错误
    }

5. 处理流程

  input := map[string]interface{}{
    "action": "pass",
  }

  result, err = flow.HandleFlow("待办流程节点实例ID", "流程处理人ID", input)
    if err != nil {
        // 处理错误
    }

6. 停止流程

    err := flow.StopFlow("待办流程节点实例ID", func(flowInstance *schema.FlowInstance) bool {
        return flowInstance.Launcher == "XXX"
    })
    if err != nil {
        // 处理错误
    }

7. 接入WEB流程管理

func main() {
serverOptions := []flow.ServerOption{
        flow.ServerStaticRootOption("./web"),
        flow.ServerPrefixOption("/flow/"),
        flow.ServerMiddlewareOption(filter),
    }

    http.Handle("/flow/", flow.StartServer(serverOptions...))
}

func filter(ctx *gear.Context) error {
    fmt.Printf("请求参数:%s - %s \n", ctx.Path, ctx.Method)
    return nil
}

8. 查询流程待办数据

    result,err := flow.QueryTodoFlows("流程编号","流程处理人ID")
    if err != nil {
        // 处理错误
    }

9. 查询流程历史数据

result,err := flow.QueryFlowHistory("待办流程实例ID")
if err != nil {
    // 处理错误
}

10. 查询已办理的流程实例ID列表

ids,err := flow.QueryDoneFlowIDs("流程编号","流程处理人ID")
if err != nil {
    // 处理错误
}

11. 查询节点实例的候选人ID列表

ids,err := flow.QueryNodeCandidates("待办流程节点实例ID")
if err != nil {
    // 处理错误
}

12. 停止流程实例

    err := flow.StopFlowInstance("待办流程节点实例ID", func(flowInstance *schema.FlowInstance) bool {
        return flowInstance.Launcher == "XXX"
    })
    if err != nil {
        // 处理错误
    }

流程管理 流程设计器

Extension points exported contracts — how you extend this code

Renderer (Interface)
Renderer 表单渲染器 [1 implementers]
render.go
Parser (Interface)
Parser 流程数据解析器 [1 implementers]
parse.go
ExpContext (Interface)
ExpContext 表达式上下文 ,实现 context.Context接口 [1 implementers]
expression/expression.go
ServerOption (FuncType)
ServerOption 流程服务配置
server.go
NextNodeHandle (FuncType)
NextNodeHandle 定义下一节点处理函数
node_router.go
Execer (Interface)
Execer 表达式执行器
exec.go
Option (FuncType)
Option 配置项
service/db/db.go
Execer (Interface)
Execer 表达式执行器
expression/expression.go

Core symbols most depended-on inside this repo

n
called by 2543
example/web/0.async.js
n
called by 804
example/web/index.js
r
called by 678
example/web/0.async.js
o
called by 540
example/web/0.async.js
i
called by 530
example/web/0.async.js
n
called by 424
example/web/1.async.js
s
called by 365
example/web/0.async.js
a
called by 335
example/web/0.async.js

Shape

Function 592
Method 154
Struct 54
Interface 6
FuncType 5
Class 3
TypeAlias 2

Languages

TypeScript62%
Go38%

Modules by API surface

example/web/index.js249 symbols
example/web/1.async.js139 symbols
example/web/0.async.js74 symbols
service/db/db.go26 symbols
model/m_flow.go22 symbols
engine.go22 symbols
bll/b_flow.go22 symbols
schema/s_flow.go20 symbols
example/web/2.async.js18 symbols
node_router.go15 symbols
expression/exec_test.go15 symbols
flow.go14 symbols

For agents

$ claude mcp add flow \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact