-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtag.go
58 lines (48 loc) · 950 Bytes
/
tag.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 eventkit
import (
"time"
"storj.io/eventkit/pb"
)
type Tag = *pb.Tag
func String(key string, val string) Tag {
return &pb.Tag{
Key: key,
Value: &pb.Tag_String_{String_: []byte(val)},
}
}
func Bytes(key string, val []byte) Tag {
return &pb.Tag{
Key: key,
Value: &pb.Tag_Bytes{Bytes: val},
}
}
func Int64(key string, val int64) Tag {
return &pb.Tag{
Key: key,
Value: &pb.Tag_Int64{Int64: val},
}
}
func Float64(key string, val float64) Tag {
return &pb.Tag{
Key: key,
Value: &pb.Tag_Double{Double: val},
}
}
func Bool(key string, val bool) Tag {
return &pb.Tag{
Key: key,
Value: &pb.Tag_Bool{Bool: val},
}
}
func Duration(key string, val time.Duration) Tag {
return &pb.Tag{
Key: key,
Value: &pb.Tag_DurationNs{DurationNs: int64(val)},
}
}
func Timestamp(key string, val time.Time) Tag {
return &pb.Tag{
Key: key,
Value: &pb.Tag_Timestamp{Timestamp: pb.AsTimestamp(val)},
}
}