Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoOffersFound = errors.New("no offers found") ErrFailedToApplyOption = errors.New("failed to apply option") ErrFailedToCreateMetrics = errors.New("failed to create metric from provider") )
View Source
var Defaults = []Option{ WithMeter(otel.Meter("github.com/andrewhowdencom/courses.pito/delivery-service/carriers")), }
Functions ¶
This section is empty.
Types ¶
type Carrier ¶
type Carrier interface { // Query allows a provider to return a list of possible delivery options, or an error if there is a failure // in some way to query the service. Query(*Package) ([]*DeliveryOption, error) }
Carrier is the interface that all carriers must meet. It ensure that we can provide a standard set of information, and get an appropriate response.
type Carriers ¶
type Carriers struct {
// contains filtered or unexported fields
}
Carriers is a wrapper around all individual carriers to aggregate the results from those carriers into a single set of delivery options.
Later it will be extended to include statistics for each carrier.
type DeliveryOption ¶
type DeliveryOption struct { // The provider that expects to fulfil this method Provider string `json:"provider"` // The cost of the delivery option, should it be booked Cost *money.Money `json:"cost"` // The estimated arrival (within 6 hours) that the package will be delivered. Arrival time.Time `json:"arrival"` }
DeliveryOption is an option that can be booked for a delivery.
type Option ¶
func WithCarrier ¶
WithCarrier adds a carrier to the carriers primitive
Click to show internal directories.
Click to hide internal directories.