Documentation
¶
Index ¶
- Variables
- func Load(cfg config.Config)
- func LoadFrom(dir string, prefix string)
- func ProcessClose(process *gou.Process) interface{}
- func ProcessDone(process *gou.Process) interface{}
- func ProcessFind(process *gou.Process) interface{}
- func ProcessGoto(process *gou.Process) interface{}
- func ProcessNext(process *gou.Process) interface{}
- func ProcessOpen(process *gou.Process) interface{}
- func ProcessReset(process *gou.Process) interface{}
- func ProcessSave(process *gou.Process) interface{}
- func ProcessSetting(process *gou.Process) interface{}
- func ProcessStatus(process *gou.Process) interface{}
- type API
- type Input
- type Next
- type Node
- type User
- type WorkFlow
- func (workflow *WorkFlow) AddAPI(api *gou.HTTP, path gou.Path)
- func (workflow *WorkFlow) Close(uid int, id int, output map[string]interface{}) map[string]interface{}
- func (workflow *WorkFlow) Conditions(conds []helper.Condition, data map[string]interface{}) []helper.Condition
- func (workflow *WorkFlow) Done(uid int, id int, output map[string]interface{}) map[string]interface{}
- func (workflow *WorkFlow) Find(id int) map[string]interface{}
- func (workflow *WorkFlow) FlowNodes(data map[string]interface{}) []map[string]interface{}
- func (workflow *WorkFlow) GetNodeWhen(next Next, data map[string]interface{}) *Node
- func (workflow *WorkFlow) Goto(uid int, id int, name string, output map[string]interface{}) map[string]interface{}
- func (workflow *WorkFlow) IsLastNode(name string) bool
- func (workflow *WorkFlow) Len() int
- func (workflow *WorkFlow) MergeData(data interface{}, new interface{}) map[string]interface{}
- func (workflow *WorkFlow) MergeUsers(data interface{}, new interface{}) map[string]interface{}
- func (workflow *WorkFlow) Next(uid int, id int, output map[string]interface{}) map[string]interface{}
- func (workflow *WorkFlow) Open(uid int, id interface{}) map[string]interface{}
- func (workflow *WorkFlow) Reload() *WorkFlow
- func (workflow *WorkFlow) Reset(uid int, id int, output map[string]interface{}) map[string]interface{}
- func (workflow *WorkFlow) Save(uid int, name string, id interface{}, input Input, ...) map[string]interface{}
- func (workflow *WorkFlow) Setting(uid int, id interface{}) map[string]interface{}
- func (workflow *WorkFlow) SetupAPIs() error
- func (workflow *WorkFlow) Status(uid int, id int, status string, output map[string]interface{}) map[string]interface{}
- func (workflow *WorkFlow) UserIDs(users map[string]interface{}) string
Constants ¶
This section is empty.
Variables ¶
var WorkFlows = map[string]*WorkFlow{}
WorkFlows 工作流列表
Functions ¶
func ProcessClose ¶
ProcessClose xiang.workflow.Close 标记关闭流程
args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )
return: map[string]interface{} 工作流数据记录
func ProcessDone ¶
ProcessDone xiang.workflow.Done 标记结束流程
args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )
return: map[string]interface{} 工作流数据记录
func ProcessFind ¶
ProcessFind xiang.workflow.Find 读取工作流
args: [工作流名称*, 工作流ID*]
return: map[string]interface{} 工作流数据记录
func ProcessGoto ¶
ProcessGoto xiang.workflow.Goto 跳转到指定节点
args: [工作流名称*, 当前用户ID*, 工作流ID*, 节点名称*, 输出数据*] (输出数据: {"foo":"bar"} )
return: map[string]interface{} 工作流数据记录
func ProcessNext ¶
ProcessNext xiang.workflow.Next 进入下一个节点
args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )
return: map[string]interface{} 工作流数据记录
func ProcessOpen ¶
ProcessOpen xiang.workflow.Open 读取工作流
args: [工作流名称*, 当前用户ID*, 关联数据ID*]
return: map[string]interface{} 工作流数据记录
func ProcessReset ¶
ProcessReset xiang.workflow.Reset 标记重置流程
args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )
return: map[string]interface{} 工作流数据记录
func ProcessSave ¶
ProcessSave xiang.workflow.Save 保存工作流节点信息
args: [工作流名称*, 当前用户ID*, 节点名称*, 关联数据ID*, 输入数据*, 输出数据] (输入数据: {"data":{}, "form":{}} data 关联数据记录信息, form 工作流body表单信息, 输出数据: {"foo":"bar"} )
return: map[string]interface{} 工作流数据记录
func ProcessSetting ¶
ProcessSetting xiang.workflow.Setting 读取工作流配置
args: [工作流名称*, 当前用户ID*, 关联数据ID*]
return: map[string]interface{} 工作流配置
func ProcessStatus ¶
ProcessStatus xiang.workflow.Status 更新工作流状态
args: [工作流名称*, 当前用户ID*, 工作流ID*, 状态名称*, 输出数据*] (输出数据: {"foo":"bar"} )
return: map[string]interface{} 工作流数据记录
Types ¶
type API ¶
type API struct {
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Process string `json:"process"`
Args []interface{} `json:"args"`
}
API 工作相关API
type Input ¶
type Input struct {
Data map[string]interface{} `json:"data"` // 记录数据
Form map[string]interface{} `json:"form"` // 表单数据
}
Input 用户输入数据
type Next ¶
type Next struct {
Conditions []helper.Condition `json:"when,omitempty"`
Goto string `json:"goto,omitempty"`
}
Next 下一个节点描述
type Node ¶
type Node struct {
Name string `json:"name"`
Body share.Render `json:"body,omitempty"`
Actions []string `json:"actions,omitempty"`
User User `json:"user,omitempty"`
Next []Next `json:"next,omitempty"`
}
Node 工作流节点
type User ¶
type User struct {
Process string `json:"process"`
Args []interface{} `json:"args"`
}
User 工作流相关用户读取条件
type WorkFlow ¶
type WorkFlow struct {
Name string `json:"-"`
Source []byte `json:"-"`
Version string `json:"version"`
Label string `json:"label,omitempty"`
Decription string `json:"decription,omitempty"`
Nodes []Node `json:"nodes"`
APIs map[string]API `json:"apis"`
Actions map[string]share.Render `json:"actions"`
}
WorkFlow 工作流配置结构
func LoadWorkFlow ¶
LoadWorkFlow 载入工作流
func (*WorkFlow) Close ¶
func (workflow *WorkFlow) Close(uid int, id int, output map[string]interface{}) map[string]interface{}
Close 标记关闭 uid 当前处理人ID, id 工作流ID
func (*WorkFlow) Conditions ¶
func (workflow *WorkFlow) Conditions(conds []helper.Condition, data map[string]interface{}) []helper.Condition
Conditions 处理绑定参数
func (*WorkFlow) Done ¶
func (workflow *WorkFlow) Done(uid int, id int, output map[string]interface{}) map[string]interface{}
Done 标记完成 uid 当前处理人ID, id 工作流ID
func (*WorkFlow) GetNodeWhen ¶
GetNodeWhen 读取节点
func (*WorkFlow) Goto ¶
func (workflow *WorkFlow) Goto(uid int, id int, name string, output map[string]interface{}) map[string]interface{}
Goto 工作流跳转
func (*WorkFlow) IsLastNode ¶
IsLastNode 检查是否为最后一个节点
func (*WorkFlow) MergeUsers ¶
MergeUsers 合并数据
func (*WorkFlow) Next ¶
func (workflow *WorkFlow) Next(uid int, id int, output map[string]interface{}) map[string]interface{}
Next 下一个工作流 uid 当前处理人ID, id 工作流ID
func (*WorkFlow) Reset ¶
func (workflow *WorkFlow) Reset(uid int, id int, output map[string]interface{}) map[string]interface{}
Reset 重新开始 uid 当前处理人ID, id 工作流ID
func (*WorkFlow) Save ¶
func (workflow *WorkFlow) Save(uid int, name string, id interface{}, input Input, outputs ...map[string]interface{}) map[string]interface{}
Save 保存工作流节点数据 此版本使用Like实现 uid 当前处理人ID, id 数据ID