-
Notifications
You must be signed in to change notification settings - Fork 488
/
api.go
58 lines (44 loc) · 1.74 KB
/
api.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
package apisjob
import (
"build-booster/gateway/pkg/api"
"build-booster/server/pkg/engine/apisjob"
)
const (
queryRequestCPUKey = "request_cpu"
queryLeastCPUKey = "least_cpu"
)
var (
defaultMySQL apisjob.MySQL
// implements the keys that can be filtered with "In" during task list
listTaskInKey = api.WithBasicGroup(api.GroupListTaskInKey, map[string]bool{})
// implements the keys that can be filtered with "Gt" during task list
listTaskGtKey = api.WithBasicGroup(api.GroupListTaskGtKey, map[string]bool{})
// implements the keys that can be filtered with "Lt" during task list
listTaskLtKey = api.WithBasicGroup(api.GroupListTaskLtKey, map[string]bool{})
// implements the keys that can be filtered with "In" during project list
listProjectInKey = api.WithBasicGroup(api.GroupListProjectInKey, map[string]bool{
queryRequestCPUKey: true,
queryLeastCPUKey: true,
})
// implements the keys that can be filtered with "In" during whitelist list
listWhitelistInKey = api.WithBasicGroup(api.GroupListWhitelistInKey, map[string]bool{})
// implements the int keys
intKey = api.WithBasicGroup(api.GroupIntKey, map[string]bool{})
// implements the int64 keys
int64Key = api.WithBasicGroup(api.GroupInt64Key, map[string]bool{})
// implements the bool keys
boolKey = api.WithBasicGroup(api.GroupBoolKey, map[string]bool{})
// implements the float64 keys
float64Key = api.WithBasicGroup(api.GroupBoolKey, map[string]bool{
queryRequestCPUKey: true,
queryLeastCPUKey: true,
})
)
// InitStorage After server init, the instances of manager, store ... etc. should be given into api handler.
func InitStorage() (err error) {
defaultMySQL = api.GetXNAPISServerAPIResource().MySQL
return nil
}
func init() {
api.RegisterInitFunc(InitStorage)
}