Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ErrorOther is a generic error ErrorOther int = iota // ErrorDuplicate is returned when a duplicate truck is created ErrorDuplicate // ErrorNotFound is returned when a truck is not found ErrorNotFound // ErrorValidation is returned when a truck is not valid or JSON parsing fails ErrorValidation )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { // API includes the trucks service, we're not using DI here Service Service // Use composition and embedding to wrap & extend the API base api.Base }
API is the main truck API
type Truck ¶
type Truck struct { // The truck ID ID string `json:"id"` // The name of the truck Name string `json:"name"` // Descripton / long text Description string `json:"description"` // Latitude location Lat float64 `json:"lat"` // Longitude location Long float64 `json:"long"` // Address in human readable form Address string `json:"address"` // contains filtered or unexported fields }
"Truck" is the main truck model, used for both requests and responses swagger:model truck
type TruckService ¶
type TruckService struct {
// contains filtered or unexported fields
}
TruckService is implementation of the Service interface backed by a database
func NewService ¶
func NewService(db data.Database) *TruckService
NewService returns a new instance of TruckService
Click to show internal directories.
Click to hide internal directories.