I have created a map with the following structure:
m := make(map[int]Record)
The Record is a struct as follows:
type Record struct {
UID int
Type string
Year string
}
The SumRecord struct is supposed to store information about the number of occurences of every given Type / Year Value in map m.
type SumRecord struct {
Sum int
Type string
Year string
}
The struct is supposed to hold information about book publication years, ie {1, "Type": "fiction", "Year": 1996}, {2, "Type": "non-fiction", "Year": 1996}
I am unsuccessfully trying to create a second map where I would store the sum of each publication type per year (similar to a SUM / GROUP BY in SQL). How can I achieve that with Go?