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


server

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

Overview

Index

Package files

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

func DecodePickRequest

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

DecodePickRequest returns a decoder for requests sent to the sommelier pick endpoint.

func EncodePickError

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

EncodePickError returns an encoder for errors returned by the pick sommelier endpoint.

func EncodePickResponse

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

EncodePickResponse returns an encoder for responses returned by the sommelier pick endpoint.

func Mount

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

Mount configures the mux to serve the sommelier endpoints.

func MountPickHandler

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

MountPickHandler configures the mux to serve the “sommelier” service “pick” endpoint.

func NewPickCriteria

func NewPickCriteria(body *PickRequestBody) *sommelier.Criteria

NewPickCriteria builds a sommelier service pick endpoint payload.

func NewPickHandler

func NewPickHandler(
    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

NewPickHandler creates a HTTP handler which loads the HTTP request and calls the “sommelier” service “pick” endpoint.

func PickSommelierPath

func PickSommelierPath() string

PickSommelierPath returns the URL path to the sommelier service pick HTTP endpoint.

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 PickNoCriteriaResponseBody

type PickNoCriteriaResponseBody string

PickNoCriteriaResponseBody is the type of the “sommelier” service “pick” endpoint HTTP response body for the “no_criteria” error.

func NewPickNoCriteriaResponseBody

func NewPickNoCriteriaResponseBody(res sommelier.NoCriteria) PickNoCriteriaResponseBody

NewPickNoCriteriaResponseBody builds the HTTP response body from the result of the “pick” endpoint of the “sommelier” service.

type PickNoMatchResponseBody

type PickNoMatchResponseBody string

PickNoMatchResponseBody is the type of the “sommelier” service “pick” endpoint HTTP response body for the “no_match” error.

func NewPickNoMatchResponseBody

func NewPickNoMatchResponseBody(res sommelier.NoMatch) PickNoMatchResponseBody

NewPickNoMatchResponseBody builds the HTTP response body from the result of the “pick” endpoint of the “sommelier” service.

type PickRequestBody

type PickRequestBody struct {
    // Name of bottle to pick
    Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
    // Varietals in preference order
    Varietal []string `form:"varietal,omitempty" json:"varietal,omitempty" xml:"varietal,omitempty"`
    // Winery of bottle to pick
    Winery *string `form:"winery,omitempty" json:"winery,omitempty" xml:"winery,omitempty"`
}

PickRequestBody is the type of the “sommelier” service “pick” endpoint HTTP request body.

type Server

type Server struct {
    Mounts []*MountPoint
    Pick   http.Handler
}

Server lists the sommelier service endpoint HTTP handlers.

func New

func New(
    e *sommelier.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),
) *Server

New instantiates HTTP handlers for all the sommelier 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 StoredBottleResponseBody

type StoredBottleResponseBody 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"`
}

StoredBottleResponseBody is used to define fields on response body types.

func (*StoredBottleResponseBody) Validate

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

Validate runs the validations defined on StoredBottleResponseBody

type StoredBottleResponseBodyCollection

type StoredBottleResponseBodyCollection []*StoredBottleResponseBody

StoredBottleResponseBodyCollection is the type of the “sommelier” service “pick” endpoint HTTP response body.

func NewStoredBottleResponseBodyCollection

func NewStoredBottleResponseBodyCollection(res sommelierviews.StoredBottleCollectionView) StoredBottleResponseBodyCollection

NewStoredBottleResponseBodyCollection builds the HTTP response body from the result of the “pick” endpoint of the “sommelier” service.

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