I have a map which is like this
Key: 9970DLXEVOQ0O Value: [{9972IOFNIDER6 0.3},{9972MFYWYJIEK 0.2},{9972QIUUINW6R 0.5}]
Key: 9970DLXEVOQ01 Value: [{9972IOFNIDER6 0.3}]
Key: 9970QYPOYUUIO Value: [{9972VOFA3OJLK 0.4}]
in golang named product_deal in which key is string and value is a struct :
type product_detail struct {
deal_id string
rating float64
}
I need to sort the values based on ratings(descending ) in each value field the output should be i.e
Key: 9970DLXEVOQ0O Value: [{9972QIUUINW6R 0.5},{9972IOFNIDER6 0.3},{9972MFYWYJIEK 0.2}]
Key: 9970DLXEVOQ01 Value: [{9972IOFNIDER6 0.3}]
Key: 9970QYPOYUUIO Value: [{9972VOFA3OJLK 0.4}]
Any ideas of how this needs to be done. i did have a look at other post which sort maps but could not get the implementation. Any help would be appreciated.