location.go 742 B

1234567891011121314151617181920212223242526
  1. package model
  2. import "errors"
  3. // UNLocode is the United Nations location code that uniquely identifies a
  4. // particular location.
  5. //
  6. // http://www.unece.org/cefact/locode/
  7. // http://www.unece.org/cefact/locode/DocColumnDescription.htm#LOCODE
  8. type UNLocode string
  9. // Location is a location is our model is stops on a journey, such as cargo
  10. // origin or destination, or carrier movement endpoints.
  11. type Location struct {
  12. UNLocode UNLocode
  13. Name string
  14. }
  15. // ErrUnknownLocation is used when a location could not be found.
  16. var ErrUnknownLocation = errors.New("unknown location")
  17. // LocationRepository provides access a location store.
  18. type LocationRepository interface {
  19. Find(locode UNLocode) (*Location, error)
  20. FindAll() []*Location
  21. }