Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ixiongjianbo committed Jun 6, 2023
1 parent a1fe23b commit b619a39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ func MakeMaps[KeyType KeyTypeDef, ItemType any](slice []ItemType, field string)
if index >= 0 {
key := v.Field(index).Interface()
if convertKey, ok := key.(KeyType); ok {
result[convertKey] = append(result[convertKey], elem)
if query, queryOk := result[convertKey]; queryOk {
result[convertKey] = append(query, elem)
} else {
result[convertKey] = []ItemType{elem}
}
}
}
}
Expand Down

0 comments on commit b619a39

Please sign in to comment.