forked from bearded-web/bearded
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
81 lines (60 loc) · 1.61 KB
/
constants.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package plugin
import "encoding/json"
type PluginType string
const (
Util PluginType = "util"
Script PluginType = "script"
)
var pluginTypes = []interface{}{
Util,
Script,
}
func (t PluginType) String() string {
return string(t)
}
// It's a hack to show custom type as string in swagger
func (t PluginType) MarshalJSON() ([]byte, error) {
return json.Marshal(string(t))
}
func (t PluginType) Enum() []interface{} {
return pluginTypes
}
func (t PluginType) Convert(text string) (interface{}, error) {
return PluginType(text), nil
}
// =========
type PluginWeight string
const (
Light PluginWeight = "light"
Middle PluginWeight = "middle"
Heavy PluginWeight = "heavy"
)
var pluginWeights = []interface{}{
Light,
Middle,
Heavy,
}
// It's a hack to show custom type as string in swagger
func (t PluginWeight) MarshalJSON() ([]byte, error) {
return json.Marshal(string(t))
}
func (t PluginWeight) Enum() []interface{} {
return pluginWeights
}
func (t PluginWeight) Convert(text string) (interface{}, error) {
return PluginWeight(text), nil
}
// =========
type Dependence string
const (
Blocking Dependence = "blocking" // plugin will not run if dependency doesn't exist
Important Dependence = "important" // plugin will run with warnings
Optional Dependence = "optional" // plugin will run with info messages
)
// =========
type LinkType string
const (
Input LinkType = "input" // take output from previous plugin execution
Output LinkType = "output" // send output from current plugin execution to the next plugin
Parallel LinkType = "parallel" // plugins communicates with each other
)