github.com/goadesign/goa/examples/cellar/gen/sommelier
sommelier
import "github.com/goadesign/goa/examples/cellar/gen/sommelier"
Overview
Index
- Constants
- Variables
- func NewPickEndpoint(s Service) goa.Endpoint
- func NewViewedStoredBottleCollection(res StoredBottleCollection, view string) sommelierviews.StoredBottleCollection
- type Client
- type Component
- type Criteria
- type Endpoints
- type NoCriteria
- type NoMatch
- type Service
- type StoredBottle
- type StoredBottleCollection
- type Winery
Package files
client.go endpoints.go service.go
Constants
const ServiceName = "sommelier"
ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.
Variables
var MethodNames = [1]string{"pick"}
MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.
func NewPickEndpoint
func NewPickEndpoint(s Service) goa.Endpoint
NewPickEndpoint returns an endpoint function that calls the method “pick” of service “sommelier”.
func NewViewedStoredBottleCollection
func NewViewedStoredBottleCollection(res StoredBottleCollection, view string) sommelierviews.StoredBottleCollection
NewViewedStoredBottleCollection initializes viewed result type StoredBottleCollection from result type StoredBottleCollection using the given view.
type Client
type Client struct {
PickEndpoint goa.Endpoint
}
Client is the “sommelier” service client.
func NewClient
func NewClient(pick goa.Endpoint) *Client
NewClient initializes a “sommelier” service client given the endpoints.
func (*Client) Pick
func (c *Client) Pick(ctx context.Context, p *Criteria) (res StoredBottleCollection, err error)
Pick calls the “pick” endpoint of the “sommelier” service. Pick may return the following errors:
- "no_criteria" (type NoCriteria)
- "no_match" (type NoMatch)
- error: internal error
type Component
type Component struct {
// Grape varietal
Varietal string
// Percentage of varietal in wine
Percentage *uint32
}
type Criteria
type Criteria struct {
// Name of bottle to pick
Name *string
// Varietals in preference order
Varietal []string
// Winery of bottle to pick
Winery *string
}
Criteria is the payload type of the sommelier service pick method.
type Endpoints
type Endpoints struct {
Pick goa.Endpoint
}
Endpoints wraps the “sommelier” service endpoints.
func NewEndpoints
func NewEndpoints(s Service) *Endpoints
NewEndpoints wraps the methods of the “sommelier” service with endpoints.
func (*Endpoints) Use
func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)
Use applies the given middleware to all the “sommelier” service endpoints.
type NoCriteria
type NoCriteria string
Missing criteria
func (NoCriteria) Error
func (e NoCriteria) Error() string
Error returns an error description.
func (NoCriteria) ErrorName
func (e NoCriteria) ErrorName() string
ErrorName returns “no_criteria”.
type NoMatch
type NoMatch string
No bottle matched given criteria
func (NoMatch) Error
func (e NoMatch) Error() string
Error returns an error description.
func (NoMatch) ErrorName
func (e NoMatch) ErrorName() string
ErrorName returns “no_match”.
type Service
type Service interface {
// Pick implements pick.
Pick(context.Context, *Criteria) (res StoredBottleCollection, err error)
}
The sommelier service retrieves bottles given a set of criteria.
type StoredBottle
type StoredBottle struct {
// ID is the unique id of the bottle.
ID string
// Name of bottle
Name string
// Winery that produces wine
Winery *Winery
// Vintage of bottle
Vintage uint32
// Composition is the list of grape varietals and associated percentage.
Composition []*Component
// Description of bottle
Description *string
// Rating of bottle from 1 (worst) to 5 (best)
Rating *uint32
}
A StoredBottle describes a bottle retrieved by the storage service.
type StoredBottleCollection
type StoredBottleCollection []*StoredBottle
StoredBottleCollection is the result type of the sommelier service pick method.
func NewStoredBottleCollection
func NewStoredBottleCollection(vres sommelierviews.StoredBottleCollection) StoredBottleCollection
NewStoredBottleCollection initializes result type StoredBottleCollection from viewed result type StoredBottleCollection.
type Winery
type Winery struct {
// Name of winery
Name string
// Region of winery
Region string
// Country of winery
Country string
// Winery website URL
URL *string
}
Generated by godoc2md