I'm trying to merge the array values of multiple arrays with same keys (sort of group by + merge). Is there any native way in Go to transform this input:
input = [
[
{ a: 1, b: [1,2]},
{ a: 2, b: [1,2]},
{ a: 3, b: [1,2]}
],
[
{ a: 1, b: [3,4]},
{ a: 2, b: [3,4]},
{ a: 3, b: [3,4]},
{ a: 4, b: [3,4]}
],
[
{ a:1, b: [5,6]},
{ a:2, b: [5,6]},
{ a:3, b: [5,6]},
{ a:4, b: [5,6]},
{ a:5, b: [5,6]}
]
]
into:
output = [
{ a: 1, b: [1,2,3,4,5,6]},
{ a: 2, b: [1,2,3,4,5,6]},
{ a: 3, b: [1,2,3,4,5,6]},
{ a: 4, b: [3,4, 5,6]},
{ a: 5, b: [5,6]},
]