package sorting import ( "strings" fleetsstorage "git.coopgo.io/coopgo-platform/fleets/storage" ) type VehiclesByLicencePlate []fleetsstorage.Vehicle func (a VehiclesByLicencePlate) Len() int { return len(a) } func (a VehiclesByLicencePlate) Less(i, j int) bool { return strings.Compare(a[i].Data["licence_plate"].(string), a[j].Data["licence_plate"].(string)) < 0 } func (a VehiclesByLicencePlate) Swap(i, j int) { a[i], a[j] = a[j], a[i] } type BookingsByStartdate []fleetsstorage.Booking func (a BookingsByStartdate) Len() int { return len(a) } func (a BookingsByStartdate) Less(i, j int) bool { return a[i].Startdate.Before(a[j].Startdate) } func (a BookingsByStartdate) Swap(i, j int) { a[i], a[j] = a[j], a[i] }