Documentation ¶
Overview ¶
Package tracking provides the use-case of tracking a cargo. Used by views facing the end-user.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidArgument = errors.New("invalid argument")
ErrInvalidArgument is returned when one or more arguments are invalid.
Functions ¶
Types ¶
type Cargo ¶
type Cargo struct { TrackingID string `json:"tracking_id"` StatusText string `json:"status_text"` Origin string `json:"origin"` Destination string `json:"destination"` ETA time.Time `json:"eta"` NextExpectedActivity string `json:"next_expected_activity"` ArrivalDeadline time.Time `json:"arrival_deadline"` Events []Event `json:"events"` }
Cargo is a read model for tracking views.
type Leg ¶
type Leg struct { VoyageNumber string `json:"voyage_number"` From string `json:"from"` To string `json:"to"` LoadTime time.Time `json:"load_time"` UnloadTime time.Time `json:"unload_time"` }
Leg is a read model for booking views.
type Service ¶
type Service interface { // Track returns a cargo matching a tracking ID. Track(id string) (Cargo, error) }
Service is the interface that provides the basic Track method.
func NewInstrumentingService ¶
func NewInstrumentingService(requestCount metrics.Counter, requestLatency metrics.TimeHistogram, s Service) Service
NewInstrumentingService returns an instance of an instrumenting Service.
func NewLoggingService ¶
NewLoggingService returns a new instance of a logging Service.
func NewService ¶
func NewService(cargos cargo.Repository, handlingEvents cargo.HandlingEventRepository) Service
NewService returns a new instance of the default Service.
Click to show internal directories.
Click to hide internal directories.