@@ -8,12 +8,17 @@ import (
88
99type BaseFeatureView struct {
1010 name string
11- features []* core. FeatureSpecV2
11+ features []* Feature
1212 projection * FeatureViewProjection
1313}
1414
15- func NewBaseFeatureView (name string , features []* core.FeatureSpecV2 ) * BaseFeatureView {
16- base := & BaseFeatureView {name : name , features : features }
15+ func NewBaseFeatureView (name string , featureProtos []* core.FeatureSpecV2 ) * BaseFeatureView {
16+ base := & BaseFeatureView {name : name }
17+ features := make ([]* Feature , len (featureProtos ))
18+ for index , featureSpecV2 := range featureProtos {
19+ features [index ] = NewFeatureFromProto (featureSpecV2 )
20+ }
21+ base .features = features
1722 base .projection = NewFeatureViewProjectionFromDefinition (base )
1823 return base
1924}
@@ -26,12 +31,12 @@ func (fv *BaseFeatureView) withProjection(projection *FeatureViewProjection) (*B
2631 }
2732 features := make (map [string ]bool )
2833 for _ , feature := range fv .features {
29- features [feature .Name ] = true
34+ features [feature .name ] = true
3035 }
3136 for _ , feature := range projection .features {
32- if _ , ok := features [feature .Name ]; ! ok {
37+ if _ , ok := features [feature .name ]; ! ok {
3338 return nil , errors .New (fmt .Sprintf ("The projection for %s cannot be applied because it contains %s which the " +
34- "FeatureView doesn't have." , projection .name , feature .Name ))
39+ "FeatureView doesn't have." , projection .name , feature .name ))
3540 }
3641 }
3742 return & BaseFeatureView {name : fv .name , features : fv .features , projection : projection }, nil
0 commit comments