@@ -13,12 +13,13 @@ const (
13
13
DUMMY_ENTITY_VAL = ""
14
14
)
15
15
16
- var DUMMY_ENTITY types.Value = types.Value {Val : & types.Value_StringVal {StringVal : DUMMY_ENTITY_VAL }}
16
+ var DUMMY_ENTITY_VALUE types.Value = types.Value {Val : & types.Value_StringVal {StringVal : DUMMY_ENTITY_VAL }}
17
17
18
18
type FeatureView struct {
19
- Base * BaseFeatureView
20
- Ttl * durationpb.Duration
21
- Entities []string
19
+ Base * BaseFeatureView
20
+ Ttl * durationpb.Duration
21
+ Entities []string
22
+ EntityColumns []* Feature
22
23
}
23
24
24
25
func NewFeatureViewFromProto (proto * core.FeatureView ) * FeatureView {
@@ -30,23 +31,37 @@ func NewFeatureViewFromProto(proto *core.FeatureView) *FeatureView {
30
31
} else {
31
32
featureView .Entities = proto .Spec .Entities
32
33
}
34
+ entityColumns := make ([]* Feature , len (proto .Spec .EntityColumns ))
35
+ for i , entityColumn := range proto .Spec .EntityColumns {
36
+ entityColumns [i ] = NewFeatureFromProto (entityColumn )
37
+ }
38
+ featureView .EntityColumns = entityColumns
33
39
return featureView
34
40
}
35
41
36
- func (fs * FeatureView ) NewFeatureViewFromBase (base * BaseFeatureView ) * FeatureView {
37
- ttl := durationpb.Duration {Seconds : fs .Ttl .Seconds , Nanos : fs .Ttl .Nanos }
42
+ func (fv * FeatureView ) NewFeatureViewFromBase (base * BaseFeatureView ) * FeatureView {
43
+ ttl := durationpb.Duration {Seconds : fv .Ttl .Seconds , Nanos : fv .Ttl .Nanos }
38
44
featureView := & FeatureView {Base : base ,
39
45
Ttl : & ttl ,
40
- Entities : fs .Entities ,
46
+ Entities : fv .Entities ,
41
47
}
42
48
return featureView
43
49
}
44
50
45
- func (fs * FeatureView ) HasEntity (lookup string ) bool {
46
- for _ , entityName := range fs .Entities {
51
+ func (fv * FeatureView ) HasEntity (lookup string ) bool {
52
+ for _ , entityName := range fv .Entities {
47
53
if entityName == lookup {
48
54
return true
49
55
}
50
56
}
51
57
return false
52
58
}
59
+
60
+ func (fv * FeatureView ) GetEntityType (lookup string ) types.ValueType_Enum {
61
+ for _ , entityColumn := range fv .EntityColumns {
62
+ if entityColumn .Name == lookup {
63
+ return entityColumn .Dtype
64
+ }
65
+ }
66
+ return types .ValueType_INVALID
67
+ }
0 commit comments