I'm pretty new to golang and struggling a bit with converting flat database results into a nested JSON object.
As an example... I have
[]item is what I get back from my db query and I want to convert it into a json object that matches the race struct.
items := []item{
item{"1", "racename1", "scooby", 1000},
item{"1", "racename1", "scrappy", 9000},
item{"1", "racename1", "shaggy", 1000},
item{"2", "racename2", "shaggy", 450},
item{"2", "racename2", "fred", 550},
}
I'm pretty sure I need to use maps and append some slices... but any pointing in the right direction would surely be appreciated.