Documentation ¶
Index ¶
- Variables
- func Stringify[T fmt.Stringer](items []T) []string
- func ValidateVehicle(value any) []string
- type ApiError
- type ApiErrorType
- type AuthInfo
- type BulkApiResponse
- type FailureDetails
- type FetchVehicleParams
- type ListVehiclesParams
- type Page
- type PaginatedResponse
- type PaginatedVehiclesResponse
- type PaginationLinks
- type PropulsionType
- func (x PropulsionType) IsValid() bool
- func (x PropulsionType) MarshalText() ([]byte, error)
- func (x *PropulsionType) Scan(value interface{}) (err error)
- func (x PropulsionType) String() string
- func (x *PropulsionType) UnmarshalText(text []byte) error
- func (x PropulsionType) Value() (driver.Value, error)
- type Record
- type Set
- type URL
- type Vehicle
- type VehicleRepository
- type VehicleType
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidApiErrorType = errors.New("not a valid ApiErrorType")
var ErrInvalidPropulsionType = errors.New("not a valid PropulsionType")
var ErrInvalidVehicleType = errors.New("not a valid VehicleType")
Functions ¶
func ValidateVehicle ¶
Types ¶
type ApiError ¶
type ApiError struct { Type ApiErrorType Details []string }
func (ApiError) Description ¶
func (ApiError) MarshalJSON ¶
type ApiErrorType ¶
type ApiErrorType int
ENUM(unknown, bad_param, missing_param, already_registered, unregistered)
const ( // ApiErrorTypeUnknown is a ApiErrorType of type Unknown. ApiErrorTypeUnknown ApiErrorType = iota // ApiErrorTypeBadParam is a ApiErrorType of type Bad_param. ApiErrorTypeBadParam // ApiErrorTypeMissingParam is a ApiErrorType of type Missing_param. ApiErrorTypeMissingParam // ApiErrorTypeAlreadyRegistered is a ApiErrorType of type Already_registered. ApiErrorTypeAlreadyRegistered // ApiErrorTypeUnregistered is a ApiErrorType of type Unregistered. ApiErrorTypeUnregistered )
func ParseApiErrorType ¶
func ParseApiErrorType(name string) (ApiErrorType, error)
ParseApiErrorType attempts to convert a string to a ApiErrorType.
func (ApiErrorType) IsValid ¶
func (x ApiErrorType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ApiErrorType) MarshalText ¶
func (x ApiErrorType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (*ApiErrorType) Scan ¶
func (x *ApiErrorType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (ApiErrorType) String ¶
func (x ApiErrorType) String() string
String implements the Stringer interface.
func (*ApiErrorType) UnmarshalText ¶
func (x *ApiErrorType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type BulkApiResponse ¶
type BulkApiResponse[T any] struct { Success int Total int Failures []FailureDetails[T] }
func (BulkApiResponse[T]) MarshalJSON ¶
func (response BulkApiResponse[T]) MarshalJSON() ([]byte, error)
type FailureDetails ¶
func (FailureDetails[T]) MarshalJSON ¶
func (failure FailureDetails[T]) MarshalJSON() ([]byte, error)
KLUDGE:
Because we are embedding ApiError in FailureDetails, and ApiError has a overridden Marshaler implementation which gets promoted to FailureDetails by embedding, if we do not manually serializel FailureDetails here the Item field will never be output because the promoted Mashaler implementation knows nothing about FailureDetails fields.
type FetchVehicleParams ¶
type ListVehiclesParams ¶
type PaginatedResponse ¶
type PaginatedResponse struct { Version string `json:"version"` Links PaginationLinks `json:"links"` }
type PaginatedVehiclesResponse ¶
type PaginatedVehiclesResponse struct { PaginatedResponse Vehicles []Vehicle `json:"vehicles"` }
type PaginationLinks ¶
type PropulsionType ¶
type PropulsionType int
ENUM(unknown, human, electric_assist, electric, combustion, combustion_diesel, hybrid, hydrogen_fuel_cell, plug_in_hybrid)
const ( // PropulsionTypeUnknown is a PropulsionType of type Unknown. PropulsionTypeUnknown PropulsionType = iota // PropulsionTypeHuman is a PropulsionType of type Human. PropulsionTypeHuman // PropulsionTypeElectricAssist is a PropulsionType of type Electric_assist. PropulsionTypeElectricAssist // PropulsionTypeElectric is a PropulsionType of type Electric. PropulsionTypeElectric // PropulsionTypeCombustion is a PropulsionType of type Combustion. PropulsionTypeCombustion // PropulsionTypeCombustionDiesel is a PropulsionType of type Combustion_diesel. PropulsionTypeCombustionDiesel // PropulsionTypeHybrid is a PropulsionType of type Hybrid. PropulsionTypeHybrid // PropulsionTypeHydrogenFuelCell is a PropulsionType of type Hydrogen_fuel_cell. PropulsionTypeHydrogenFuelCell // PropulsionTypePlugInHybrid is a PropulsionType of type Plug_in_hybrid. PropulsionTypePlugInHybrid )
func ParsePropulsionType ¶
func ParsePropulsionType(name string) (PropulsionType, error)
ParsePropulsionType attempts to convert a string to a PropulsionType.
func (PropulsionType) IsValid ¶
func (x PropulsionType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (PropulsionType) MarshalText ¶
func (x PropulsionType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (*PropulsionType) Scan ¶
func (x *PropulsionType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (PropulsionType) String ¶
func (x PropulsionType) String() string
String implements the Stringer interface.
func (*PropulsionType) UnmarshalText ¶
func (x *PropulsionType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Set ¶
type Set[T constraints.Ordered] []T
func NewSet ¶
func NewSet[T constraints.Ordered](items ...T) Set[T]
func (*Set[T]) UnmarshalJSON ¶
type Vehicle ¶
type Vehicle struct { DeviceID uuid.UUID `json:"device_id"` ProviderID uuid.UUID `json:"provider_id"` DataProviderID uuid.UUID `json:"data_provider_id,omitempty"` VehicleID string `json:"vehicle_id"` VehicleType VehicleType `json:"vehicle_type"` VehicleAttributes Record `json:"vehicle_attributes"` PropulsionTypes Set[PropulsionType] `json:"propulsion_types"` AccessibilityAttributes Record `json:"accessibility_attributes,omitempty"` BatteryCapacity int `json:"battery_capacity,omitempty"` FuelCapacity int `json:"fuel_capacity,omitempty"` MaximumSpeed int `json:"maximum_speed"` }
type VehicleRepository ¶
type VehicleRepository interface { FetchVehicle(ctx context.Context, params FetchVehicleParams) (Vehicle, error) ListVehicles(ctx context.Context, params ListVehiclesParams) (Page[Vehicle], error) InsertVehicle(ctx context.Context, vehicle Vehicle) error UpdateVehicle(ctx context.Context, vehicle Vehicle) error }
type VehicleType ¶
type VehicleType int
ENUM(other, bicycle, bus, cargo_bicycle, car, delivery_robot, moped, scooter_standing, scooter_seated, truck)
const ( // VehicleTypeOther is a VehicleType of type Other. VehicleTypeOther VehicleType = iota // VehicleTypeBicycle is a VehicleType of type Bicycle. VehicleTypeBicycle // VehicleTypeBus is a VehicleType of type Bus. VehicleTypeBus // VehicleTypeCargoBicycle is a VehicleType of type Cargo_bicycle. VehicleTypeCargoBicycle // VehicleTypeCar is a VehicleType of type Car. VehicleTypeCar // VehicleTypeDeliveryRobot is a VehicleType of type Delivery_robot. VehicleTypeDeliveryRobot // VehicleTypeMoped is a VehicleType of type Moped. VehicleTypeMoped // VehicleTypeScooterStanding is a VehicleType of type Scooter_standing. VehicleTypeScooterStanding // VehicleTypeScooterSeated is a VehicleType of type Scooter_seated. VehicleTypeScooterSeated // VehicleTypeTruck is a VehicleType of type Truck. VehicleTypeTruck )
func ParseVehicleType ¶
func ParseVehicleType(name string) (VehicleType, error)
ParseVehicleType attempts to convert a string to a VehicleType.
func (VehicleType) IsValid ¶
func (x VehicleType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (VehicleType) MarshalText ¶
func (x VehicleType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (*VehicleType) Scan ¶
func (x *VehicleType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (VehicleType) String ¶
func (x VehicleType) String() string
String implements the Stringer interface.
func (*VehicleType) UnmarshalText ¶
func (x *VehicleType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.