https://github.com/zone-7/andflow_go
https://github.com/zone-7/andflow_go
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zone-7/andflow_go
- Owner: zone-7
- Created: 2022-11-28T08:26:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-16T02:51:16.000Z (over 1 year ago)
- Last Synced: 2025-01-16T03:32:27.944Z (over 1 year ago)
- Language: Go
- Size: 390 KB
- Stars: 7
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
这个项目使用golang开发,用于执行andflow的流程设计结果json文件。

#### 目前开源版本支持单机执行,需要支持集群并行计算版本请联系作者。

## 入门例子
```
import (
"fmt"
"io/ioutil"
"github.com/zone-7/andflow_go/actions"
"github.com/zone-7/andflow_go/andflow"
)
func main() {
file := "4执行脚本.json"
andflow.RegistActionRunner("common", &actions.CommonActionRunner{})
param := make(map[string]interface{})
data, _ := ioutil.ReadFile(file)
flow, err := andflow.ParseFlow(string(data))
if err != nil {
fmt.Println(err)
return
}
runtime := andflow.CreateRuntime(flow, param)
runner := andflow.CommonFlowRunner{}
andflow.Execute(runtime, &runner, 10000)
fmt.Println("time used(ms):", runtime.Timeused)
}
```
## 执行步骤如下:
```
//1. 设置参数
param := make(map[string]interface{})
//读取流程json文件
data, _ := ioutil.ReadFile(demo_path + "/5执行命令.json")
//2. 解析json文件
flow, err := andflow.ParseFlow(string(data))
if err != nil {
fmt.Println(err)
}
//3. 创建一个运行时
runtime := andflow.CreateRuntime(flow, param)
//4. 执行流程,超时时间是10000毫秒
andflow.Execute(runtime, 10000)
```