-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathtypes.go
More file actions
57 lines (47 loc) · 1.38 KB
/
types.go
File metadata and controls
57 lines (47 loc) · 1.38 KB
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
package feast
import (
"github.com/feast-dev/feast/sdk/go/protos/feast/types"
"github.com/golang/protobuf/proto"
)
// Row is a map of fields
type Row map[string]*types.Value
func (r Row) equalTo(other Row) bool {
for k, v := range r {
if otherV, ok := other[k]; !ok {
return false
} else {
if !proto.Equal(v, otherV) {
return false
}
}
}
return true
}
// StrVal is a string type feast value
func StrVal(val string) *types.Value {
return &types.Value{Val: &types.Value_StringVal{StringVal: val}}
}
// Int32Val is a int32 type feast value
func Int32Val(val int32) *types.Value {
return &types.Value{Val: &types.Value_Int32Val{Int32Val: val}}
}
// Int64Val is a int64 type feast value
func Int64Val(val int64) *types.Value {
return &types.Value{Val: &types.Value_Int64Val{Int64Val: val}}
}
// FloatVal is a float32 type feast value
func FloatVal(val float32) *types.Value {
return &types.Value{Val: &types.Value_FloatVal{FloatVal: val}}
}
// DoubleVal is a float64 type feast value
func DoubleVal(val float64) *types.Value {
return &types.Value{Val: &types.Value_DoubleVal{DoubleVal: val}}
}
// BoolVal is a bool type feast value
func BoolVal(val bool) *types.Value {
return &types.Value{Val: &types.Value_BoolVal{BoolVal: val}}
}
// BytesVal is a bytes type feast value
func BytesVal(val []byte) *types.Value {
return &types.Value{Val: &types.Value_BytesVal{BytesVal: val}}
}