Add documents
This commit is contained in:
23
utils/sorting/fleets.go
Normal file
23
utils/sorting/fleets.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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] }
|
||||
1
utils/sorting/sorting.go
Normal file
1
utils/sorting/sorting.go
Normal file
@@ -0,0 +1 @@
|
||||
package sorting
|
||||
Reference in New Issue
Block a user