Golang: group and sum slice of structs
<p>I come from the .NET world where I had LINQ so I could do in-memory queries like the one we usually see in SQL.</p>

<p>I have a slice of this structure I want to group by 8 fields, and then sum another integer field. Something like:</p>

<pre><code>type Register struct {
    id1 int
    id2 int
    id3 int
    id4 int
    id5 int
    id6 int
    id7 int
    id8 int
    money int
}
</code></pre>

<p>I thought in:</p>

<ul>
<li>Creating an Equal function, to compare structures (those eight<br>
fields).
Iterate over the collection I'm analyzing.  For each item<br>
check if it is already in the hash table.  If it is there => I sum
the field.  If it is not => I add the new item to hash table.</li>
</ul>

<p>Is there a better way or any beautiful, efficient and easy ready to use
library?</p>