kit: github.com/go-kit/kit/examples/shipping/tracking Index | Files

package tracking

import "github.com/go-kit/kit/examples/shipping/tracking"

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

Index

Package Files

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

Variables

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 13 packages (graph) and is imported by 7 packages. Updated 2017-05-26. Refresh now. Tools for package owners.