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

package voyage

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

Package voyage provides the Voyage aggregate.

Index

Package Files

sample_voyages.go voyage.go

Variables

var (
    V100 = New("V100", Schedule{
        []CarrierMovement{
            {DepartureLocation: location.CNHKG, ArrivalLocation: location.JNTKO},
            {DepartureLocation: location.JNTKO, ArrivalLocation: location.USNYC},
        },
    })

    V300 = New("V300", Schedule{
        []CarrierMovement{
            {DepartureLocation: location.JNTKO, ArrivalLocation: location.NLRTM},
            {DepartureLocation: location.NLRTM, ArrivalLocation: location.DEHAM},
            {DepartureLocation: location.DEHAM, ArrivalLocation: location.AUMEL},
            {DepartureLocation: location.AUMEL, ArrivalLocation: location.JNTKO},
        },
    })

    V400 = New("V400", Schedule{
        []CarrierMovement{
            {DepartureLocation: location.DEHAM, ArrivalLocation: location.SESTO},
            {DepartureLocation: location.SESTO, ArrivalLocation: location.FIHEL},
            {DepartureLocation: location.FIHEL, ArrivalLocation: location.DEHAM},
        },
    })
)

A set of sample voyages.

var (
    V0100S = New("0100S", Schedule{[]CarrierMovement{}})
    V0200T = New("0200T", Schedule{[]CarrierMovement{}})
    V0300A = New("0300A", Schedule{[]CarrierMovement{}})
    V0301S = New("0301S", Schedule{[]CarrierMovement{}})
    V0400S = New("0400S", Schedule{[]CarrierMovement{}})
)

These voyages are hard-coded into the current pathfinder. Make sure they exist.

var ErrUnknown = errors.New("unknown voyage")

ErrUnknown is used when a voyage could not be found.

type CarrierMovement Uses

type CarrierMovement struct {
    DepartureLocation location.UNLocode
    ArrivalLocation   location.UNLocode
    DepartureTime     time.Time
    ArrivalTime       time.Time
}

CarrierMovement is a vessel voyage from one location to another.

type Number Uses

type Number string

Number uniquely identifies a particular Voyage.

type Repository Uses

type Repository interface {
    Find(Number) (*Voyage, error)
}

Repository provides access a voyage store.

type Schedule Uses

type Schedule struct {
    CarrierMovements []CarrierMovement
}

Schedule describes a voyage schedule.

type Voyage Uses

type Voyage struct {
    Number   Number
    Schedule Schedule
}

Voyage is a uniquely identifiable series of carrier movements.

func New Uses

func New(n Number, s Schedule) *Voyage

New creates a voyage with a voyage number and a provided schedule.

Package voyage imports 3 packages (graph) and is imported by 31 packages. Updated 2016-11-09. Refresh now. Tools for package owners.