Reputation: 7136
I want to set values in a particular format as follows:
discoveryAttr[0]["add"] = []string{"brand_name"}
How to design my map here?
Here 0 is not a slice index. It refers to the value of item - like itemId.
Upvotes: 0
Views: 79
Reputation: 7136
A go map must have 2 components only.
map[key]data -> key and data can be any type of value.
In the above case, the 1st key is int. Hence the value must mapstring
Hence, the type will be map[int](map[string]([]string)))
Upvotes: 2