Documentation ¶
Index ¶
- Constants
- Variables
- func NewAddEndpoint(s Service) goa.Endpoint
- func NewListEndpoint(s Service) goa.Endpoint
- func NewMultiAddEndpoint(s Service) goa.Endpoint
- func NewMultiUpdateEndpoint(s Service) goa.Endpoint
- func NewRateEndpoint(s Service) goa.Endpoint
- func NewRemoveEndpoint(s Service) goa.Endpoint
- func NewShowEndpoint(s Service) goa.Endpoint
- func NewViewedStoredBottle(res *StoredBottle, view string) *storageviews.StoredBottle
- func NewViewedStoredBottleCollection(res StoredBottleCollection, view string) storageviews.StoredBottleCollection
- type Bottle
- type Client
- func (c *Client) Add(ctx context.Context, p *Bottle) (res string, err error)
- func (c *Client) List(ctx context.Context) (res StoredBottleCollection, err error)
- func (c *Client) MultiAdd(ctx context.Context, p []*Bottle) (res []string, err error)
- func (c *Client) MultiUpdate(ctx context.Context, p *MultiUpdatePayload) (err error)
- func (c *Client) Rate(ctx context.Context, p map[uint32][]string) (err error)
- func (c *Client) Remove(ctx context.Context, p *RemovePayload) (err error)
- func (c *Client) Show(ctx context.Context, p *ShowPayload) (res *StoredBottle, err error)
- type Component
- type Endpoints
- type MultiUpdatePayload
- type NotFound
- type RemovePayload
- type Service
- type ShowPayload
- type StoredBottle
- type StoredBottleCollection
- type Winery
Constants ¶
const APIName = "cellar"
APIName is the name of the API as defined in the design.
const APIVersion = "0.0.1"
APIVersion is the version of the API as defined in the design.
const ServiceName = "storage"
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 = [7]string{"list", "show", "add", "remove", "rate", "multi_add", "multi_update"}
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.
Functions ¶
func NewAddEndpoint ¶
NewAddEndpoint returns an endpoint function that calls the method "add" of service "storage".
func NewListEndpoint ¶
NewListEndpoint returns an endpoint function that calls the method "list" of service "storage".
func NewMultiAddEndpoint ¶
NewMultiAddEndpoint returns an endpoint function that calls the method "multi_add" of service "storage".
func NewMultiUpdateEndpoint ¶
NewMultiUpdateEndpoint returns an endpoint function that calls the method "multi_update" of service "storage".
func NewRateEndpoint ¶
NewRateEndpoint returns an endpoint function that calls the method "rate" of service "storage".
func NewRemoveEndpoint ¶
NewRemoveEndpoint returns an endpoint function that calls the method "remove" of service "storage".
func NewShowEndpoint ¶
NewShowEndpoint returns an endpoint function that calls the method "show" of service "storage".
func NewViewedStoredBottle ¶
func NewViewedStoredBottle(res *StoredBottle, view string) *storageviews.StoredBottle
NewViewedStoredBottle initializes viewed result type StoredBottle from result type StoredBottle using the given view.
func NewViewedStoredBottleCollection ¶
func NewViewedStoredBottleCollection(res StoredBottleCollection, view string) storageviews.StoredBottleCollection
NewViewedStoredBottleCollection initializes viewed result type StoredBottleCollection from result type StoredBottleCollection using the given view.
Types ¶
type Bottle ¶
type Bottle struct { // 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 }
Bottle is the payload type of the storage service add method.
type Client ¶
type Client struct { ListEndpoint goa.Endpoint ShowEndpoint goa.Endpoint AddEndpoint goa.Endpoint RemoveEndpoint goa.Endpoint RateEndpoint goa.Endpoint MultiAddEndpoint goa.Endpoint MultiUpdateEndpoint goa.Endpoint }
Client is the "storage" service client.
func (*Client) List ¶
func (c *Client) List(ctx context.Context) (res StoredBottleCollection, err error)
List calls the "list" endpoint of the "storage" service.
func (*Client) MultiUpdate ¶
func (c *Client) MultiUpdate(ctx context.Context, p *MultiUpdatePayload) (err error)
MultiUpdate calls the "multi_update" endpoint of the "storage" service.
func (*Client) Remove ¶
func (c *Client) Remove(ctx context.Context, p *RemovePayload) (err error)
Remove calls the "remove" endpoint of the "storage" service. Remove may return the following errors:
- "not_found" (type *NotFound): Bottle not found
- error: internal error
func (*Client) Show ¶
func (c *Client) Show(ctx context.Context, p *ShowPayload) (res *StoredBottle, err error)
Show calls the "show" endpoint of the "storage" service. Show may return the following errors:
- "not_found" (type *NotFound): Bottle not found
- error: internal error
type Endpoints ¶
type Endpoints struct { List goa.Endpoint Show goa.Endpoint Add goa.Endpoint Remove goa.Endpoint Rate goa.Endpoint MultiAdd goa.Endpoint MultiUpdate goa.Endpoint }
Endpoints wraps the "storage" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "storage" service with endpoints.
type MultiUpdatePayload ¶
type MultiUpdatePayload struct { // IDs of the bottles to be updated Ids []string // Array of bottle info that matches the ids attribute Bottles []*Bottle }
MultiUpdatePayload is the payload type of the storage service multi_update method.
type NotFound ¶
NotFound is the type returned when attempting to show or delete a bottle that does not exist.
func (*NotFound) ErrorName
deprecated
ErrorName returns "NotFound".
Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
func (*NotFound) GoaErrorName ¶
GoaErrorName returns "NotFound".
type RemovePayload ¶
type RemovePayload struct { // ID of bottle to remove ID string }
RemovePayload is the payload type of the storage service remove method.
type Service ¶
type Service interface { // List all stored bottles List(context.Context) (res StoredBottleCollection, err error) // Show bottle by ID // The "view" return value must have one of the following views // - "default" // - "tiny" Show(context.Context, *ShowPayload) (res *StoredBottle, view string, err error) // Add new bottle and return its ID. Add(context.Context, *Bottle) (res string, err error) // Remove bottle from storage Remove(context.Context, *RemovePayload) (err error) // Rate bottles by IDs Rate(context.Context, map[uint32][]string) (err error) // Add n number of bottles and return their IDs. This is a multipart request // and each part has field name 'bottle' and contains the encoded bottle info // to be added. MultiAdd(context.Context, []*Bottle) (res []string, err error) // Update bottles with the given IDs. This is a multipart request and each part // has field name 'bottle' and contains the encoded bottle info to be updated. // The IDs in the query parameter is mapped to each part in the request. MultiUpdate(context.Context, *MultiUpdatePayload) (err error) }
The storage service makes it possible to view, add or remove wine bottles.
type ShowPayload ¶
ShowPayload is the payload type of the storage service show method.
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 }
StoredBottle is the result type of the storage service show method.
func NewStoredBottle ¶
func NewStoredBottle(vres *storageviews.StoredBottle) *StoredBottle
NewStoredBottle initializes result type StoredBottle from viewed result type StoredBottle.
type StoredBottleCollection ¶
type StoredBottleCollection []*StoredBottle
StoredBottleCollection is the result type of the storage service list method.
func NewStoredBottleCollection ¶
func NewStoredBottleCollection(vres storageviews.StoredBottleCollection) StoredBottleCollection
NewStoredBottleCollection initializes result type StoredBottleCollection from viewed result type StoredBottleCollection.