Add documents

This commit is contained in:
2022-11-01 00:40:20 +01:00
parent f4c2d61dc3
commit 0dd4a723be
24 changed files with 687 additions and 65 deletions

23
utils/sorting/fleets.go Normal file
View 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
View File

@@ -0,0 +1 @@
package sorting