kit: Index | Files

package tracking

import ""

Package tracking provides the use-case of tracking a cargo. Used by views facing the end-user.


Package Files

endpoint.go instrumenting.go logging.go service.go transport.go


var ErrInvalidArgument = errors.New("invalid argument")

ErrInvalidArgument is returned when one or more arguments are invalid.

func MakeHandler Uses

func MakeHandler(ts Service, logger kitlog.Logger) http.Handler

MakeHandler returns a handler for the tracking service.

type Cargo Uses

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 Event Uses

type Event struct {
    Description string `json:"description"`
    Expected    bool   `json:"expected"`

Event is a read model for tracking views.

type Leg Uses

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 Uses

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 Uses

func NewInstrumentingService(counter metrics.Counter, latency metrics.Histogram, s Service) Service

NewInstrumentingService returns an instance of an instrumenting Service.

func NewLoggingService Uses

func NewLoggingService(logger log.Logger, s Service) Service

NewLoggingService returns a new instance of a logging Service.

func NewService Uses

func NewService(cargos cargo.Repository, events cargo.HandlingEventRepository) Service

NewService returns a new instance of the default Service.

Package tracking imports 14 packages (graph) and is imported by 15 packages. Updated 2019-04-24. Refresh now. Tools for package owners.