Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lookupable ¶
type Lookupable interface { Name() string Supports(country vehicle.RegCountry) bool LookupVIN(string) (vehicle.Vehicle, error) LookupRegNr(string) (vehicle.Vehicle, error) }
Lookupable is the interface that each direct vehicle lookup service must implement.
type Manager ¶
type Manager map[string]Lookupable
Manager keeps track of, and lets you interact with, registered lookup services.
func NewManager ¶
func NewManager() *Manager
NewManager returns a new Manager, which is able to keep track of multiple lookup services.
func (*Manager) AddService ¶
func (mngr *Manager) AddService(service Lookupable)
AddService adds an auto service to the Manager.
func (*Manager) FindServiceByCountry ¶
func (mngr *Manager) FindServiceByCountry(country vehicle.RegCountry) Lookupable
FindServiceByCountry returns the first service that supports the given country, or nil.
type NrpladeService ¶
type NrpladeService struct {
Service
}
NrpladeService integrates with a Danish license plate lookup service.
func NewNrpladeService ¶
func NewNrpladeService(cnf config.LookupConfig) *NrpladeService
NewNrpladeService returns a new Nrplade service for direct vehicle lookups.
func (*NrpladeService) LookupRegNr ¶
func (service *NrpladeService) LookupRegNr(regNr string) (vehicle.Vehicle, error)
LookupRegNr looks up a vehicle based on registration number.
func (*NrpladeService) LookupVIN ¶
func (service *NrpladeService) LookupVIN(vin string) (vehicle.Vehicle, error)
LookupVIN looks up a vehicle based on VIN number.
func (*NrpladeService) Name ¶
func (service *NrpladeService) Name() string
Name returns the service name.
func (*NrpladeService) Supports ¶
func (service *NrpladeService) Supports(country vehicle.RegCountry) bool
Supports returns true if the given country is supported by this service.
type Service ¶
type Service struct { Name string Conf config.LookupConfig }
Service handles the shared part of various Service implementations.