1 // Package voyage provides the Voyage aggregate.
8 "github.com/go-kit/kit/examples/shipping/location"
11 // Number uniquely identifies a particular Voyage.
14 // Voyage is a uniquely identifiable series of carrier movements.
20 // New creates a voyage with a voyage number and a provided schedule.
21 func New(n Number, s Schedule) *Voyage {
22 return &Voyage{Number: n, Schedule: s}
25 // Schedule describes a voyage schedule.
26 type Schedule struct {
27 CarrierMovements []CarrierMovement
30 // CarrierMovement is a vessel voyage from one location to another.
31 type CarrierMovement struct {
32 DepartureLocation location.UNLocode
33 ArrivalLocation location.UNLocode
34 DepartureTime time.Time
38 // ErrUnknown is used when a voyage could not be found.
39 var ErrUnknown = errors.New("unknown voyage")
41 // Repository provides access a voyage store.
42 type Repository interface {
43 Find(Number) (*Voyage, error)