-
Notifications
You must be signed in to change notification settings - Fork 66
/
processor-base.go
44 lines (35 loc) · 1.09 KB
/
processor-base.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package agentExec
import (
"github.com/aaronchen2k/deeptest/internal/pkg/consts"
)
type ProcessorEntityBase struct {
Name string `gorm:"-" json:"name"`
Comments string `json:"comments"`
Default string `json:"default"`
ProcessorID uint `json:"processorID" yaml:"processorID"`
ProcessorCategory consts.ProcessorCategory `json:"processorCategory" yaml:"processorCategory"`
ProcessorType consts.ProcessorType `json:"processorType" yaml:"processorType"`
ParentID uint `json:"parentID" yaml:"parentID"`
}
type IProcessorEntity interface {
Run(*Processor, *Session) error
}
func getPreviousBrother(processor Processor) (brother Processor, ok bool) {
for index, item := range processor.Parent.Children {
if item.ID == processor.ID && index > 0 {
brother = *processor.Parent.Children[index-1]
ok = true
}
}
return
}
func getResultStatus(pass bool) (resultStatus consts.ResultStatus, desc string) {
if pass {
resultStatus = consts.Pass
desc = "通过"
} else {
resultStatus = consts.Fail
desc = "失败"
}
return
}