Documentation
¶
Index ¶
- func DecodeFooMethodRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)
- func EncodeFooMethodResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error
- func FooMethodFooServicePath() string
- func Mount(mux goahttp.Muxer, h *Server)
- func MountFooMethodHandler(mux goahttp.Muxer, h http.Handler)
- func NewFooMethodHandler(endpoint goa.Endpoint, mux goahttp.Muxer, ...) http.Handler
- func NewFooMethodPayload(body *FooMethodRequestBody) *fooservice.FooMethodPayload
- func ValidateExternalTypeRequestBody(body *ExternalTypeRequestBody) (err error)
- func ValidateFieldWithExtensionRequestBody(body *FieldWithExtensionRequestBody) (err error)
- func ValidateFooMethodRequestBody(body *FooMethodRequestBody) (err error)
- type Bar
- type ErrorNamer
- type ExampleTypeResponse
- type ExternalTypeRequestBody
- type ExternalTypeResponse
- type FieldWithExtensionRequestBody
- type FieldWithExtensionResponse
- type FooMethodRequestBody
- type FooMethodResponseBody
- type MountPoint
- type SecondExternalTypeRequestBody
- type SecondExternalTypeResponse
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeFooMethodRequest ¶
func DecodeFooMethodRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)
DecodeFooMethodRequest returns a decoder for requests sent to the FooService FooMethod endpoint.
func EncodeFooMethodResponse ¶
func EncodeFooMethodResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error
EncodeFooMethodResponse returns an encoder for responses returned by the FooService FooMethod endpoint.
func FooMethodFooServicePath ¶
func FooMethodFooServicePath() string
FooMethodFooServicePath returns the URL path to the FooService service FooMethod HTTP endpoint.
func MountFooMethodHandler ¶
MountFooMethodHandler configures the mux to serve the "FooService" service "FooMethod" endpoint.
func NewFooMethodHandler ¶
func NewFooMethodHandler( endpoint goa.Endpoint, mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder, encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, errhandler func(context.Context, http.ResponseWriter, error), formatter func(err error) goahttp.Statuser, ) http.Handler
NewFooMethodHandler creates a HTTP handler which loads the HTTP request and calls the "FooService" service "FooMethod" endpoint.
func NewFooMethodPayload ¶
func NewFooMethodPayload(body *FooMethodRequestBody) *fooservice.FooMethodPayload
NewFooMethodPayload builds a FooService service FooMethod endpoint payload.
func ValidateExternalTypeRequestBody ¶
func ValidateExternalTypeRequestBody(body *ExternalTypeRequestBody) (err error)
ValidateExternalTypeRequestBody runs the validations defined on ExternalTypeRequestBody
func ValidateFieldWithExtensionRequestBody ¶
func ValidateFieldWithExtensionRequestBody(body *FieldWithExtensionRequestBody) (err error)
ValidateFieldWithExtensionRequestBody runs the validations defined on FieldWithExtensionRequestBody
func ValidateFooMethodRequestBody ¶
func ValidateFooMethodRequestBody(body *FooMethodRequestBody) (err error)
ValidateFooMethodRequestBody runs the validations defined on FooMethodRequestBody
Types ¶
type Bar ¶
type Bar struct {
Bar uint `form:"Bar" json:"Bar" xml:"Bar"`
}
Bar is used to define fields on response body types.
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 ExampleTypeResponse ¶
type ExampleTypeResponse struct { FieldWithExtension *FieldWithExtensionResponse `form:"FieldWithExtension,omitempty" json:"FieldWithExtension,omitempty" xml:"FieldWithExtension,omitempty"` External *ExternalTypeResponse `form:"External,omitempty" json:"External,omitempty" xml:"External,omitempty"` SecondExternal *SecondExternalTypeResponse `form:"SecondExternal,omitempty" json:"SecondExternal,omitempty" xml:"SecondExternal,omitempty"` DateField string `form:"DateField" json:"DateField" xml:"DateField"` }
ExampleTypeResponse is used to define fields on response body types.
type ExternalTypeRequestBody ¶
type ExternalTypeRequestBody struct {
Field *string `form:"Field,omitempty" json:"Field,omitempty" xml:"Field,omitempty"`
}
ExternalTypeRequestBody is used to define fields on request body types.
type ExternalTypeResponse ¶
type ExternalTypeResponse struct {
Field string `form:"Field" json:"Field" xml:"Field"`
}
ExternalTypeResponse is used to define fields on response body types.
type FieldWithExtensionRequestBody ¶
type FieldWithExtensionRequestBody struct {
BarField *Bar `form:"BarField,omitempty" json:"BarField,omitempty" xml:"BarField,omitempty"`
}
FieldWithExtensionRequestBody is used to define fields on request body types.
type FieldWithExtensionResponse ¶
type FieldWithExtensionResponse struct {
BarField *Bar `form:"BarField,omitempty" json:"BarField,omitempty" xml:"BarField,omitempty"`
}
FieldWithExtensionResponse is used to define fields on response body types.
type FooMethodRequestBody ¶
type FooMethodRequestBody struct { FieldWithExtension *FieldWithExtensionRequestBody `form:"FieldWithExtension,omitempty" json:"FieldWithExtension,omitempty" xml:"FieldWithExtension,omitempty"` External *ExternalTypeRequestBody `form:"External,omitempty" json:"External,omitempty" xml:"External,omitempty"` SecondExternal *SecondExternalTypeRequestBody `form:"SecondExternal,omitempty" json:"SecondExternal,omitempty" xml:"SecondExternal,omitempty"` DateField *string `form:"DateField,omitempty" json:"DateField,omitempty" xml:"DateField,omitempty"` }
FooMethodRequestBody is the type of the "FooService" service "FooMethod" endpoint HTTP request body.
type FooMethodResponseBody ¶
type FooMethodResponseBody []*ExampleTypeResponse
FooMethodResponseBody is the type of the "FooService" service "FooMethod" endpoint HTTP response body.
func NewFooMethodResponseBody ¶
func NewFooMethodResponseBody(res []*fooservice.ExampleType) FooMethodResponseBody
NewFooMethodResponseBody builds the HTTP response body from the result of the "FooMethod" endpoint of the "FooService" service.
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 SecondExternalTypeRequestBody ¶
type SecondExternalTypeRequestBody struct {
Field *string `form:"Field,omitempty" json:"Field,omitempty" xml:"Field,omitempty"`
}
SecondExternalTypeRequestBody is used to define fields on request body types.
type SecondExternalTypeResponse ¶
type SecondExternalTypeResponse struct {
Field *string `form:"Field,omitempty" json:"Field,omitempty" xml:"Field,omitempty"`
}
SecondExternalTypeResponse is used to define fields on response body types.
type Server ¶
type Server struct { Mounts []*MountPoint FooMethod http.Handler }
Server lists the FooService service endpoint HTTP handlers.
func New ¶
func New( e *fooservice.Endpoints, mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder, encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, errhandler func(context.Context, http.ResponseWriter, error), formatter func(err error) goahttp.Statuser, ) *Server
New instantiates HTTP handlers for all the FooService service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.