package models import "sort" type Datapoints []*Datapoint func (d *Datapoints) SortSlice() { // Sort by Path before processing sort.Slice(*d, func(i, j int) bool { return (*d)[i].Path < (*d)[j].Path }) }