As in Go to check for uniqueness dates?

In the cycle of adding dates to an array it is necessary to check for uniqueness, and if they are identical items, then it is necessary to summarize them, in other words, the data unloaded from the database to a csv file where the dates are duplicated, it is necessary that it merged into one . If you example, thank you.
July 2nd 19 at 14:11
1 answer
July 2nd 19 at 14:13
Using map, for example. Check dates in Mapa, if not, add the value, if there is, put new himeshima.
And You could small sample to bring? Want to understand how it works ,thanks. - cory.Cruicksha commented on July 2nd 19 at 14:16
: here's an example: pastebin.com/9Nu4sXHq
If you're having problems even understanding how to work with maps, it is necessary to seriously brush up on the basics go. - sam_Blanda commented on July 2nd 19 at 14:19
Maps I understand, I don't understand why it is impossible to register correctly in the code. - cory.Cruicksha commented on July 2nd 19 at 14:22
Thanks for the example. - cory.Cruicksha commented on July 2nd 19 at 14:25
It turns out after I got the data I need to put them in the map

type UserStatsData struct {
D string `json:"-"`
G int `json:"g"`
R json.Number `json:"r"`
}

parsed := make(map[string]interface{})
if err := json.Unmarshal(data, &parsed); err != nil {
log.Fatalf("error: %v", err);
}

then I understand now it is necessary for each structure to walk - cory.Cruicksha commented on July 2nd 19 at 14:28
: no, to parse data should be in the structure, and mapou only be used for calculation of the required amounts, grouped by date - sam_Blanda commented on July 2nd 19 at 14:31

Find more questions by tags Go