修改Add方法
This commit is contained in:
parent
bd1bb4a03e
commit
30e531fe09
8
flow.go
8
flow.go
|
@ -80,14 +80,20 @@ type Flow struct {
|
|||
}
|
||||
|
||||
// Add 添加
|
||||
func (flow *Flow) Add(node *FlowNode) {
|
||||
func (flow *Flow) Add(name string, task func(cxt *FlowContext) int) {
|
||||
|
||||
node := &FlowNode{Name: name}
|
||||
|
||||
if flow.Head == nil {
|
||||
flow.Head = node
|
||||
flow.Tail = node
|
||||
|
||||
node.Path = node.Name
|
||||
return
|
||||
}
|
||||
|
||||
node.Path = flow.Tail.Path + ">" + flow.Tail.Name
|
||||
|
||||
flow.Tail.next = node
|
||||
flow.Tail = node
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user