if instead of switch
Some checks failed
Build / cleanup-runs (pull_request) Failing after 2s
Build / build (pull_request) Successful in 39s
Deploy Contract / cleanup-runs (pull_request) Failing after 5s
Dependency Review / dependency-review (pull_request) Successful in 1m24s
CodeQL / Analyze (go) (pull_request) Successful in 1m45s
Pull Request Labeler / triage (pull_request) Successful in 19s
Deploy Contract / deploy (pull_request) Failing after 1m2s
Lint / Run flake8 on python integration tests (pull_request) Failing after 23s
Run Gosec / Gosec (pull_request) Successful in 27s
Tests / cleanup-runs (pull_request) Failing after 2s
Lint / Run golangci-lint (pull_request) Successful in 36s
Semgrep / Scan (pull_request) Failing after 16s
Tests / test-importer (pull_request) Successful in 1m14s
Tests / test-unit-cover (pull_request) Successful in 1m18s
Tests / test-rpc (pull_request) Successful in 1m15s
Tests / sdk_tests (pull_request) Failing after 2m24s
Some checks failed
Build / cleanup-runs (pull_request) Failing after 2s
Build / build (pull_request) Successful in 39s
Deploy Contract / cleanup-runs (pull_request) Failing after 5s
Dependency Review / dependency-review (pull_request) Successful in 1m24s
CodeQL / Analyze (go) (pull_request) Successful in 1m45s
Pull Request Labeler / triage (pull_request) Successful in 19s
Deploy Contract / deploy (pull_request) Failing after 1m2s
Lint / Run flake8 on python integration tests (pull_request) Failing after 23s
Run Gosec / Gosec (pull_request) Successful in 27s
Tests / cleanup-runs (pull_request) Failing after 2s
Lint / Run golangci-lint (pull_request) Successful in 36s
Semgrep / Scan (pull_request) Failing after 16s
Tests / test-importer (pull_request) Successful in 1m14s
Tests / test-unit-cover (pull_request) Successful in 1m18s
Tests / test-rpc (pull_request) Successful in 1m15s
Tests / sdk_tests (pull_request) Failing after 2m24s
This commit is contained in:
parent
61169a43c0
commit
911f4ec252
@ -351,25 +351,19 @@ func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) erro
|
||||
// #nosec G705
|
||||
for key := range record.Attributes {
|
||||
attr := record.Attributes[key]
|
||||
rt := reflect.TypeOf(attr)
|
||||
switch rt.Kind() {
|
||||
case reflect.Slice:
|
||||
{
|
||||
av := attr.([]interface{})
|
||||
for i := range av {
|
||||
indexKey := GetAttributesIndexKey(key, av[i])
|
||||
if err := k.SetAttributeMapping(ctx, indexKey, record.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
indexKey := GetAttributesIndexKey(key, attr)
|
||||
if reflect.Slice == reflect.TypeOf(attr).Kind() {
|
||||
av := attr.([]interface{})
|
||||
for i := range av {
|
||||
indexKey := GetAttributesIndexKey(key, av[i])
|
||||
if err := k.SetAttributeMapping(ctx, indexKey, record.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
indexKey := GetAttributesIndexKey(key, attr)
|
||||
if err := k.SetAttributeMapping(ctx, indexKey, record.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user