workflow

package
v0.10.1-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WorkFlows = map[string]*WorkFlow{}

WorkFlows 工作流列表

Functions

func Load

func Load(cfg config.Config)

Load 加载数据表格

func LoadFrom

func LoadFrom(dir string, prefix string)

LoadFrom 从特定目录加载

func ProcessClose

func ProcessClose(process *gou.Process) interface{}

ProcessClose xiang.workflow.Close 标记关闭流程

args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )

return: map[string]interface{} 工作流数据记录

func ProcessDone

func ProcessDone(process *gou.Process) interface{}

ProcessDone xiang.workflow.Done 标记结束流程

args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )

return: map[string]interface{} 工作流数据记录

func ProcessFind

func ProcessFind(process *gou.Process) interface{}

ProcessFind xiang.workflow.Find 读取工作流

args: [工作流名称*, 工作流ID*]

return: map[string]interface{} 工作流数据记录

func ProcessGoto

func ProcessGoto(process *gou.Process) interface{}

ProcessGoto xiang.workflow.Goto 跳转到指定节点

args: [工作流名称*, 当前用户ID*, 工作流ID*, 节点名称*, 输出数据*] (输出数据: {"foo":"bar"} )

return: map[string]interface{} 工作流数据记录

func ProcessNext

func ProcessNext(process *gou.Process) interface{}

ProcessNext xiang.workflow.Next 进入下一个节点

args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )

return: map[string]interface{} 工作流数据记录

func ProcessOpen

func ProcessOpen(process *gou.Process) interface{}

ProcessOpen xiang.workflow.Open 读取工作流

args: [工作流名称*, 当前用户ID*, 关联数据ID*]

return: map[string]interface{} 工作流数据记录

func ProcessReset

func ProcessReset(process *gou.Process) interface{}

ProcessReset xiang.workflow.Reset 标记重置流程

args: [工作流名称*, 当前用户ID*, 工作流ID*, 输出数据*] (输出数据: {"foo":"bar"} )

return: map[string]interface{} 工作流数据记录

func ProcessSave

func ProcessSave(process *gou.Process) interface{}

ProcessSave xiang.workflow.Save 保存工作流节点信息

args: [工作流名称*, 当前用户ID*, 节点名称*, 关联数据ID*, 输入数据*, 输出数据] (输入数据: {"data":{}, "form":{}}  data 关联数据记录信息, form 工作流body表单信息, 输出数据: {"foo":"bar"} )

return: map[string]interface{} 工作流数据记录

func ProcessSetting

func ProcessSetting(process *gou.Process) interface{}

ProcessSetting xiang.workflow.Setting 读取工作流配置

args: [工作流名称*, 当前用户ID*, 关联数据ID*]

return: map[string]interface{} 工作流配置

func ProcessStatus

func ProcessStatus(process *gou.Process) interface{}

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 用户输入数据

func InputOf

func InputOf(in map[string]interface{}) Input

InputOf 映射表转换为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 工作流节点

func (*Node) GetUID

func (node *Node) GetUID(users interface{}) int

GetUID 读取节点相关人

func (*Node) MakeUID

func (node *Node) MakeUID() int

MakeUID 根据条件选择节点处理人

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

func LoadWorkFlow(source []byte, name string) (*WorkFlow, error)

LoadWorkFlow 载入工作流

func Select

func Select(name string) *WorkFlow

Select 读取已加载图表

func (*WorkFlow) AddAPI

func (workflow *WorkFlow) AddAPI(api *gou.HTTP, path gou.Path)

AddAPI 添加API

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) Find

func (workflow *WorkFlow) Find(id int) map[string]interface{}

Find 读取给定ID的工作流 uid 当前处理人ID, id 数据ID

func (*WorkFlow) FlowNodes

func (workflow *WorkFlow) FlowNodes(data map[string]interface{}) []map[string]interface{}

FlowNodes 转换为 flow

func (*WorkFlow) GetNodeWhen

func (workflow *WorkFlow) GetNodeWhen(next Next, data map[string]interface{}) *Node

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

func (workflow *WorkFlow) IsLastNode(name string) bool

IsLastNode 检查是否为最后一个节点

func (*WorkFlow) Len

func (workflow *WorkFlow) Len() int

Len 节点数量

func (*WorkFlow) MergeData

func (workflow *WorkFlow) MergeData(data interface{}, new interface{}) map[string]interface{}

MergeData 合并数据

func (*WorkFlow) MergeUsers

func (workflow *WorkFlow) MergeUsers(data interface{}, new interface{}) map[string]interface{}

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) Open

func (workflow *WorkFlow) Open(uid int, id interface{}) map[string]interface{}

Open 读取当前工作流(未完成的) uid 当前处理人ID, id 数据ID

func (*WorkFlow) Reload

func (workflow *WorkFlow) Reload() *WorkFlow

Reload 重新载入工作流

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

func (*WorkFlow) Setting

func (workflow *WorkFlow) Setting(uid int, id interface{}) map[string]interface{}

Setting 返回配置信息 uid 当前处理人ID, id 数据ID

func (*WorkFlow) SetupAPIs

func (workflow *WorkFlow) SetupAPIs() error

SetupAPIs 注册API

func (*WorkFlow) Status

func (workflow *WorkFlow) Status(uid int, id int, status string, output map[string]interface{}) map[string]interface{}

Status 设定状态 uid 当前处理人ID, id 工作流ID

func (*WorkFlow) UserIDs

func (workflow *WorkFlow) UserIDs(users map[string]interface{}) string

UserIDs 读取用户ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL