forked from webdevops/azure-devops-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.go
56 lines (47 loc) · 754 Bytes
/
misc.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
package main
import (
"strconv"
"time"
)
func boolToString(b bool) string {
if b {
return "true"
}
return "false"
}
func boolToFloat64(b bool) float64 {
if b {
return 1
}
return 0
}
func arrayInt64Contains(s []int64, e int64) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
func int64ToString(v int64) string {
return strconv.FormatInt(v, 10)
}
func arrayStringContains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
func timeToFloat64(v time.Time) float64 {
return float64(v.Unix())
}
func scrapeIntervalStatus(v *time.Duration) (ret string) {
if v != nil && v.Seconds() > 0 {
ret = v.String()
} else {
ret = "disabled"
}
return
}