(joinKeyValues map[string]*prototypes.RepeatedValue,
requestData map[string]*prototypes.RepeatedValue,
expectedJoinKeysSet map[string]interface{})
| 272 | } |
| 273 | |
| 274 | func ValidateEntityValues(joinKeyValues map[string]*prototypes.RepeatedValue, |
| 275 | requestData map[string]*prototypes.RepeatedValue, |
| 276 | expectedJoinKeysSet map[string]interface{}) (int, error) { |
| 277 | numRows := -1 |
| 278 | if err := validateJoinKeys(joinKeyValues, expectedJoinKeysSet); err != nil { |
| 279 | return -1, errors.New("valueError: " + err.Error()) |
| 280 | } |
| 281 | for joinKey, values := range joinKeyValues { |
| 282 | if _, ok := expectedJoinKeysSet[joinKey]; !ok { |
| 283 | requestData[joinKey] = values |
| 284 | delete(joinKeyValues, joinKey) |
| 285 | // ToDo: when request data will be passed correctly (not as part of entity rows) |
| 286 | // ToDo: throw this error instead |
| 287 | // return 0, fmt.Errorf("JoinKey is not expected in this request: %s\n%v", JoinKey, expectedJoinKeysSet) |
| 288 | } else { |
| 289 | if numRows < 0 { |
| 290 | numRows = len(values.Val) |
| 291 | } else if len(values.Val) != numRows { |
| 292 | return -1, errors.New("valueError: All entity rows must have the same columns") |
| 293 | } |
| 294 | |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | return numRows, nil |
| 299 | } |
| 300 | |
| 301 | func ValidateFeatureRefs(requestedFeatures []*FeatureViewAndRefs, fullFeatureNames bool) error { |
| 302 | featureRefCounter := make(map[string]int) |
no test coverage detected