github.com/goadesign/goa/examples/cellar/gen/http/storage/server


server

import "github.com/goadesign/goa/examples/cellar/gen/http/storage/server"

Overview

Index

Package files

encode_decode.go paths.go server.go types.go

func AddStoragePath

func AddStoragePath() string

AddStoragePath returns the URL path to the storage service add HTTP endpoint.

func DecodeAddRequest

func DecodeAddRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeAddRequest returns a decoder for requests sent to the storage add endpoint.

func DecodeMultiAddRequest

func DecodeMultiAddRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeMultiAddRequest returns a decoder for requests sent to the storage multi_add endpoint.

func DecodeMultiUpdateRequest

func DecodeMultiUpdateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeMultiUpdateRequest returns a decoder for requests sent to the storage multi_update endpoint.

func DecodeRateRequest

func DecodeRateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeRateRequest returns a decoder for requests sent to the storage rate endpoint.

func DecodeRemoveRequest

func DecodeRemoveRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeRemoveRequest returns a decoder for requests sent to the storage remove endpoint.

func DecodeShowRequest

func DecodeShowRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeShowRequest returns a decoder for requests sent to the storage show endpoint.

func EncodeAddResponse

func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeAddResponse returns an encoder for responses returned by the storage add endpoint.

func EncodeListResponse

func EncodeListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeListResponse returns an encoder for responses returned by the storage list endpoint.

func EncodeMultiAddResponse

func EncodeMultiAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeMultiAddResponse returns an encoder for responses returned by the storage multi_add endpoint.

func EncodeMultiUpdateResponse

func EncodeMultiUpdateResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeMultiUpdateResponse returns an encoder for responses returned by the storage multi_update endpoint.

func EncodeRateResponse

func EncodeRateResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeRateResponse returns an encoder for responses returned by the storage rate endpoint.

func EncodeRemoveResponse

func EncodeRemoveResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeRemoveResponse returns an encoder for responses returned by the storage remove endpoint.

func EncodeShowError

func EncodeShowError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, error) error

EncodeShowError returns an encoder for errors returned by the show storage endpoint.

func EncodeShowResponse

func EncodeShowResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeShowResponse returns an encoder for responses returned by the storage show endpoint.

func ListStoragePath

func ListStoragePath() string

ListStoragePath returns the URL path to the storage service list HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the storage endpoints.

func MountAddHandler

func MountAddHandler(mux goahttp.Muxer, h http.Handler)

MountAddHandler configures the mux to serve the “storage” service “add” endpoint.

func MountListHandler

func MountListHandler(mux goahttp.Muxer, h http.Handler)

MountListHandler configures the mux to serve the “storage” service “list” endpoint.

func MountMultiAddHandler

func MountMultiAddHandler(mux goahttp.Muxer, h http.Handler)

MountMultiAddHandler configures the mux to serve the “storage” service “multi_add” endpoint.

func MountMultiUpdateHandler

func MountMultiUpdateHandler(mux goahttp.Muxer, h http.Handler)

MountMultiUpdateHandler configures the mux to serve the “storage” service “multi_update” endpoint.

func MountRateHandler

func MountRateHandler(mux goahttp.Muxer, h http.Handler)

MountRateHandler configures the mux to serve the “storage” service “rate” endpoint.

func MountRemoveHandler

func MountRemoveHandler(mux goahttp.Muxer, h http.Handler)

MountRemoveHandler configures the mux to serve the “storage” service “remove” endpoint.

func MountShowHandler

func MountShowHandler(mux goahttp.Muxer, h http.Handler)

MountShowHandler configures the mux to serve the “storage” service “show” endpoint.

func MultiAddStoragePath

func MultiAddStoragePath() string

MultiAddStoragePath returns the URL path to the storage service multi_add HTTP endpoint.

func MultiUpdateStoragePath

func MultiUpdateStoragePath() string

MultiUpdateStoragePath returns the URL path to the storage service multi_update HTTP endpoint.

func NewAddBottle

func NewAddBottle(body *AddRequestBody) *storage.Bottle

NewAddBottle builds a storage service add endpoint payload.

func NewAddHandler

func NewAddHandler(
    endpoint goa.Endpoint,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
) http.Handler

NewAddHandler creates a HTTP handler which loads the HTTP request and calls the “storage” service “add” endpoint.

func NewListHandler

func NewListHandler(
    endpoint goa.Endpoint,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
) http.Handler

NewListHandler creates a HTTP handler which loads the HTTP request and calls the “storage” service “list” endpoint.

func NewMultiAddBottle

func NewMultiAddBottle(body []*BottleRequestBody) []*storage.Bottle

NewMultiAddBottle builds a storage service multi_add endpoint payload.

func NewMultiAddHandler

func NewMultiAddHandler(
    endpoint goa.Endpoint,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
) http.Handler

NewMultiAddHandler creates a HTTP handler which loads the HTTP request and calls the “storage” service “multi_add” endpoint.

func NewMultiUpdateHandler

func NewMultiUpdateHandler(
    endpoint goa.Endpoint,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
) http.Handler

NewMultiUpdateHandler creates a HTTP handler which loads the HTTP request and calls the “storage” service “multi_update” endpoint.

func NewMultiUpdatePayload

func NewMultiUpdatePayload(body *MultiUpdateRequestBody, ids []string) *storage.MultiUpdatePayload

NewMultiUpdatePayload builds a storage service multi_update endpoint payload.

func NewRateHandler

func NewRateHandler(
    endpoint goa.Endpoint,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
) http.Handler

NewRateHandler creates a HTTP handler which loads the HTTP request and calls the “storage” service “rate” endpoint.

func NewRemoveHandler

func NewRemoveHandler(
    endpoint goa.Endpoint,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
) http.Handler

NewRemoveHandler creates a HTTP handler which loads the HTTP request and calls the “storage” service “remove” endpoint.

func NewRemovePayload

func NewRemovePayload(id string) *storage.RemovePayload

NewRemovePayload builds a storage service remove endpoint payload.

func NewShowHandler

func NewShowHandler(
    endpoint goa.Endpoint,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
) http.Handler

NewShowHandler creates a HTTP handler which loads the HTTP request and calls the “storage” service “show” endpoint.

func NewShowPayload

func NewShowPayload(id string, view *string) *storage.ShowPayload

NewShowPayload builds a storage service show endpoint payload.

func NewStorageMultiAddDecoder

func NewStorageMultiAddDecoder(mux goahttp.Muxer, storageMultiAddDecoderFn StorageMultiAddDecoderFunc) func(r *http.Request) goahttp.Decoder

NewStorageMultiAddDecoder returns a decoder to decode the multipart request for the “storage” service “multi_add” endpoint.

func NewStorageMultiUpdateDecoder

func NewStorageMultiUpdateDecoder(mux goahttp.Muxer, storageMultiUpdateDecoderFn StorageMultiUpdateDecoderFunc) func(r *http.Request) goahttp.Decoder

NewStorageMultiUpdateDecoder returns a decoder to decode the multipart request for the “storage” service “multi_update” endpoint.

func RateStoragePath

func RateStoragePath() string

RateStoragePath returns the URL path to the storage service rate HTTP endpoint.

func RemoveStoragePath

func RemoveStoragePath(id string) string

RemoveStoragePath returns the URL path to the storage service remove HTTP endpoint.

func ShowStoragePath

func ShowStoragePath(id string) string

ShowStoragePath returns the URL path to the storage service show HTTP endpoint.

type AddRequestBody

type AddRequestBody struct {
    // Name of bottle
    Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
    // Winery that produces wine
    Winery *WineryRequestBody `form:"winery,omitempty" json:"winery,omitempty" xml:"winery,omitempty"`
    // Vintage of bottle
    Vintage *uint32 `form:"vintage,omitempty" json:"vintage,omitempty" xml:"vintage,omitempty"`
    // Composition is the list of grape varietals and associated percentage.
    Composition []*ComponentRequestBody `form:"composition,omitempty" json:"composition,omitempty" xml:"composition,omitempty"`
    // Description of bottle
    Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
    // Rating of bottle from 1 (worst) to 5 (best)
    Rating *uint32 `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"`
}

AddRequestBody is the type of the “storage” service “add” endpoint HTTP request body.

func (*AddRequestBody) Validate

func (body *AddRequestBody) Validate() (err error)

Validate runs the validations defined on AddRequestBody

type BottleRequestBody

type BottleRequestBody struct {
    // Name of bottle
    Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
    // Winery that produces wine
    Winery *WineryRequestBody `form:"winery,omitempty" json:"winery,omitempty" xml:"winery,omitempty"`
    // Vintage of bottle
    Vintage *uint32 `form:"vintage,omitempty" json:"vintage,omitempty" xml:"vintage,omitempty"`
    // Composition is the list of grape varietals and associated percentage.
    Composition []*ComponentRequestBody `form:"composition,omitempty" json:"composition,omitempty" xml:"composition,omitempty"`
    // Description of bottle
    Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
    // Rating of bottle from 1 (worst) to 5 (best)
    Rating *uint32 `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"`
}

BottleRequestBody is used to define fields on request body types.

func (*BottleRequestBody) Validate

func (body *BottleRequestBody) Validate() (err error)

Validate runs the validations defined on BottleRequestBody

type ComponentRequestBody

type ComponentRequestBody struct {
    // Grape varietal
    Varietal *string `form:"varietal,omitempty" json:"varietal,omitempty" xml:"varietal,omitempty"`
    // Percentage of varietal in wine
    Percentage *uint32 `form:"percentage,omitempty" json:"percentage,omitempty" xml:"percentage,omitempty"`
}

ComponentRequestBody is used to define fields on request body types.

func (*ComponentRequestBody) Validate

func (body *ComponentRequestBody) Validate() (err error)

Validate runs the validations defined on ComponentRequestBody

type ComponentResponseBody

type ComponentResponseBody struct {
    // Grape varietal
    Varietal string `form:"varietal" json:"varietal" xml:"varietal"`
    // Percentage of varietal in wine
    Percentage *uint32 `form:"percentage,omitempty" json:"percentage,omitempty" xml:"percentage,omitempty"`
}

ComponentResponseBody is used to define fields on response body types.

func (*ComponentResponseBody) Validate

func (body *ComponentResponseBody) Validate() (err error)

Validate runs the validations defined on ComponentResponseBody

type ErrorNamer

type ErrorNamer interface {
    ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type MountPoint

type MountPoint struct {
    // Method is the name of the service method served by the mounted HTTP handler.
    Method string
    // Verb is the HTTP method used to match requests to the mounted handler.
    Verb string
    // Pattern is the HTTP request path pattern used to match requests to the
    // mounted handler.
    Pattern string
}

MountPoint holds information about the mounted endpoints.

type MultiUpdateRequestBody

type MultiUpdateRequestBody struct {
    // Array of bottle info that matches the ids attribute
    Bottles []*BottleRequestBody `form:"bottles,omitempty" json:"bottles,omitempty" xml:"bottles,omitempty"`
}

MultiUpdateRequestBody is the type of the “storage” service “multi_update” endpoint HTTP request body.

func (*MultiUpdateRequestBody) Validate

func (body *MultiUpdateRequestBody) Validate() (err error)

Validate runs the validations defined on MultiUpdateRequestBody

type Server

type Server struct {
    Mounts      []*MountPoint
    List        http.Handler
    Show        http.Handler
    Add         http.Handler
    Remove      http.Handler
    Rate        http.Handler
    MultiAdd    http.Handler
    MultiUpdate http.Handler
}

Server lists the storage service endpoint HTTP handlers.

func New

func New(
    e *storage.Endpoints,
    mux goahttp.Muxer,
    dec func(*http.Request) goahttp.Decoder,
    enc func(context.Context, http.ResponseWriter) goahttp.Encoder,
    eh func(context.Context, http.ResponseWriter, error),
    storageMultiAddDecoderFn StorageMultiAddDecoderFunc,
    storageMultiUpdateDecoderFn StorageMultiUpdateDecoderFunc,
) *Server

New instantiates HTTP handlers for all the storage service endpoints.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type ShowNotFoundResponseBody

type ShowNotFoundResponseBody struct {
    // Message of error
    Message string `form:"message" json:"message" xml:"message"`
    // ID of missing bottle
    ID string `form:"id" json:"id" xml:"id"`
}

ShowNotFoundResponseBody is the type of the “storage” service “show” endpoint HTTP response body for the “not_found” error.

func NewShowNotFoundResponseBody

func NewShowNotFoundResponseBody(res *storage.NotFound) *ShowNotFoundResponseBody

NewShowNotFoundResponseBody builds the HTTP response body from the result of the “show” endpoint of the “storage” service.

type ShowResponseBody

type ShowResponseBody struct {
    // ID is the unique id of the bottle.
    ID string `form:"id" json:"id" xml:"id"`
    // Name of bottle
    Name string `form:"name" json:"name" xml:"name"`
    // Winery that produces wine
    Winery *WineryResponseBodyTiny `form:"winery" json:"winery" xml:"winery"`
    // Vintage of bottle
    Vintage uint32 `form:"vintage" json:"vintage" xml:"vintage"`
    // Composition is the list of grape varietals and associated percentage.
    Composition []*ComponentResponseBody `form:"composition,omitempty" json:"composition,omitempty" xml:"composition,omitempty"`
    // Description of bottle
    Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
    // Rating of bottle from 1 (worst) to 5 (best)
    Rating *uint32 `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"`
}

ShowResponseBody is the type of the “storage” service “show” endpoint HTTP response body.

func NewShowResponseBody

func NewShowResponseBody(res *storageviews.StoredBottleView) *ShowResponseBody

NewShowResponseBody builds the HTTP response body from the result of the “show” endpoint of the “storage” service.

type ShowResponseBodyTiny

type ShowResponseBodyTiny struct {
    // ID is the unique id of the bottle.
    ID string `form:"id" json:"id" xml:"id"`
    // Name of bottle
    Name string `form:"name" json:"name" xml:"name"`
    // Winery that produces wine
    Winery *WineryResponseBodyTiny `form:"winery" json:"winery" xml:"winery"`
}

ShowResponseBodyTiny is the type of the “storage” service “show” endpoint HTTP response body.

func NewShowResponseBodyTiny

func NewShowResponseBodyTiny(res *storageviews.StoredBottleView) *ShowResponseBodyTiny

NewShowResponseBodyTiny builds the HTTP response body from the result of the “show” endpoint of the “storage” service.

type StorageMultiAddDecoderFunc

type StorageMultiAddDecoderFunc func(*multipart.Reader, *[]*storage.Bottle) error

StorageMultiAddDecoderFunc is the type to decode multipart request for the “storage” service “multi_add” endpoint.

type StorageMultiUpdateDecoderFunc

type StorageMultiUpdateDecoderFunc func(*multipart.Reader, **storage.MultiUpdatePayload) error

StorageMultiUpdateDecoderFunc is the type to decode multipart request for the “storage” service “multi_update” endpoint.

type StoredBottleResponseBodyTiny

type StoredBottleResponseBodyTiny struct {
    // ID is the unique id of the bottle.
    ID string `form:"id" json:"id" xml:"id"`
    // Name of bottle
    Name string `form:"name" json:"name" xml:"name"`
    // Winery that produces wine
    Winery *WineryResponseBodyTiny `form:"winery" json:"winery" xml:"winery"`
}

StoredBottleResponseBodyTiny is used to define fields on response body types.

func (*StoredBottleResponseBodyTiny) Validate

func (body *StoredBottleResponseBodyTiny) Validate() (err error)

Validate runs the validations defined on StoredBottleResponseBodyTiny

type StoredBottleResponseBodyTinyCollection

type StoredBottleResponseBodyTinyCollection []*StoredBottleResponseBodyTiny

StoredBottleResponseBodyTinyCollection is the type of the “storage” service “list” endpoint HTTP response body.

func NewStoredBottleResponseBodyTinyCollection

func NewStoredBottleResponseBodyTinyCollection(res storageviews.StoredBottleCollectionView) StoredBottleResponseBodyTinyCollection

NewStoredBottleResponseBodyTinyCollection builds the HTTP response body from the result of the “list” endpoint of the “storage” service.

type WineryRequestBody

type WineryRequestBody struct {
    // Name of winery
    Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
    // Region of winery
    Region *string `form:"region,omitempty" json:"region,omitempty" xml:"region,omitempty"`
    // Country of winery
    Country *string `form:"country,omitempty" json:"country,omitempty" xml:"country,omitempty"`
    // Winery website URL
    URL *string `form:"url,omitempty" json:"url,omitempty" xml:"url,omitempty"`
}

WineryRequestBody is used to define fields on request body types.

func (*WineryRequestBody) Validate

func (body *WineryRequestBody) Validate() (err error)

Validate runs the validations defined on WineryRequestBody

type WineryResponseBodyTiny

type WineryResponseBodyTiny struct {
    // Name of winery
    Name string `form:"name" json:"name" xml:"name"`
}

WineryResponseBodyTiny is used to define fields on response body types.


Generated by godoc2md