github.com/goadesign/goa/examples/error/gen/http/divider/server


server

import "github.com/goadesign/goa/examples/error/gen/http/divider/server"

Overview

Index

Package files

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

func DecodeDivideRequest

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

DecodeDivideRequest returns a decoder for requests sent to the divider divide endpoint.

func DecodeIntegerDivideRequest

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

DecodeIntegerDivideRequest returns a decoder for requests sent to the divider integer_divide endpoint.

func DivideDividerPath

func DivideDividerPath(a float64, b float64) string

DivideDividerPath returns the URL path to the divider service divide HTTP endpoint.

func EncodeDivideError

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

EncodeDivideError returns an encoder for errors returned by the divide divider endpoint.

func EncodeDivideResponse

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

EncodeDivideResponse returns an encoder for responses returned by the divider divide endpoint.

func EncodeIntegerDivideError

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

EncodeIntegerDivideError returns an encoder for errors returned by the integer_divide divider endpoint.

func EncodeIntegerDivideResponse

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

EncodeIntegerDivideResponse returns an encoder for responses returned by the divider integer_divide endpoint.

func IntegerDivideDividerPath

func IntegerDivideDividerPath(a int, b int) string

IntegerDivideDividerPath returns the URL path to the divider service integer_divide HTTP endpoint.

func Mount

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

Mount configures the mux to serve the divider endpoints.

func MountDivideHandler

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

MountDivideHandler configures the mux to serve the “divider” service “divide” endpoint.

func MountIntegerDivideHandler

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

MountIntegerDivideHandler configures the mux to serve the “divider” service “integer_divide” endpoint.

func NewDivideFloatOperands

func NewDivideFloatOperands(a float64, b float64) *dividersvc.FloatOperands

NewDivideFloatOperands builds a divider service divide endpoint payload.

func NewDivideHandler

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

NewDivideHandler creates a HTTP handler which loads the HTTP request and calls the “divider” service “divide” endpoint.

func NewIntegerDivideHandler

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

NewIntegerDivideHandler creates a HTTP handler which loads the HTTP request and calls the “divider” service “integer_divide” endpoint.

func NewIntegerDivideIntOperands

func NewIntegerDivideIntOperands(a int, b int) *dividersvc.IntOperands

NewIntegerDivideIntOperands builds a divider service integer_divide endpoint payload.

type DivideDivByZeroResponseBody

type DivideDivByZeroResponseBody struct {
    // Name is the name of this class of errors.
    Name string `form:"name" json:"name" xml:"name"`
    // ID is a unique identifier for this particular occurrence of the problem.
    ID string `form:"id" json:"id" xml:"id"`
    // Message is a human-readable explanation specific to this occurrence of the
    // problem.
    Message string `form:"message" json:"message" xml:"message"`
    // Is the error temporary?
    Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
    // Is the error a timeout?
    Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
    // Is the error a server-side fault?
    Fault bool `form:"fault" json:"fault" xml:"fault"`
}

DivideDivByZeroResponseBody is the type of the “divider” service “divide” endpoint HTTP response body for the “div_by_zero” error.

func NewDivideDivByZeroResponseBody

func NewDivideDivByZeroResponseBody(res *goa.ServiceError) *DivideDivByZeroResponseBody

NewDivideDivByZeroResponseBody builds the HTTP response body from the result of the “divide” endpoint of the “divider” service.

type DivideTimeoutResponseBody

type DivideTimeoutResponseBody struct {
    // Name is the name of this class of errors.
    Name string `form:"name" json:"name" xml:"name"`
    // ID is a unique identifier for this particular occurrence of the problem.
    ID string `form:"id" json:"id" xml:"id"`
    // Message is a human-readable explanation specific to this occurrence of the
    // problem.
    Message string `form:"message" json:"message" xml:"message"`
    // Is the error temporary?
    Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
    // Is the error a timeout?
    Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
    // Is the error a server-side fault?
    Fault bool `form:"fault" json:"fault" xml:"fault"`
}

DivideTimeoutResponseBody is the type of the “divider” service “divide” endpoint HTTP response body for the “timeout” error.

func NewDivideTimeoutResponseBody

func NewDivideTimeoutResponseBody(res *goa.ServiceError) *DivideTimeoutResponseBody

NewDivideTimeoutResponseBody builds the HTTP response body from the result of the “divide” endpoint of the “divider” service.

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 IntegerDivideDivByZeroResponseBody

type IntegerDivideDivByZeroResponseBody struct {
    // Name is the name of this class of errors.
    Name string `form:"name" json:"name" xml:"name"`
    // ID is a unique identifier for this particular occurrence of the problem.
    ID string `form:"id" json:"id" xml:"id"`
    // Message is a human-readable explanation specific to this occurrence of the
    // problem.
    Message string `form:"message" json:"message" xml:"message"`
    // Is the error temporary?
    Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
    // Is the error a timeout?
    Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
    // Is the error a server-side fault?
    Fault bool `form:"fault" json:"fault" xml:"fault"`
}

IntegerDivideDivByZeroResponseBody is the type of the “divider” service “integer_divide” endpoint HTTP response body for the “div_by_zero” error.

func NewIntegerDivideDivByZeroResponseBody

func NewIntegerDivideDivByZeroResponseBody(res *goa.ServiceError) *IntegerDivideDivByZeroResponseBody

NewIntegerDivideDivByZeroResponseBody builds the HTTP response body from the result of the “integer_divide” endpoint of the “divider” service.

type IntegerDivideHasRemainderResponseBody

type IntegerDivideHasRemainderResponseBody struct {
    // Name is the name of this class of errors.
    Name string `form:"name" json:"name" xml:"name"`
    // ID is a unique identifier for this particular occurrence of the problem.
    ID string `form:"id" json:"id" xml:"id"`
    // Message is a human-readable explanation specific to this occurrence of the
    // problem.
    Message string `form:"message" json:"message" xml:"message"`
    // Is the error temporary?
    Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
    // Is the error a timeout?
    Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
    // Is the error a server-side fault?
    Fault bool `form:"fault" json:"fault" xml:"fault"`
}

IntegerDivideHasRemainderResponseBody is the type of the “divider” service “integer_divide” endpoint HTTP response body for the “has_remainder” error.

func NewIntegerDivideHasRemainderResponseBody

func NewIntegerDivideHasRemainderResponseBody(res *goa.ServiceError) *IntegerDivideHasRemainderResponseBody

NewIntegerDivideHasRemainderResponseBody builds the HTTP response body from the result of the “integer_divide” endpoint of the “divider” service.

type IntegerDivideTimeoutResponseBody

type IntegerDivideTimeoutResponseBody struct {
    // Name is the name of this class of errors.
    Name string `form:"name" json:"name" xml:"name"`
    // ID is a unique identifier for this particular occurrence of the problem.
    ID string `form:"id" json:"id" xml:"id"`
    // Message is a human-readable explanation specific to this occurrence of the
    // problem.
    Message string `form:"message" json:"message" xml:"message"`
    // Is the error temporary?
    Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
    // Is the error a timeout?
    Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
    // Is the error a server-side fault?
    Fault bool `form:"fault" json:"fault" xml:"fault"`
}

IntegerDivideTimeoutResponseBody is the type of the “divider” service “integer_divide” endpoint HTTP response body for the “timeout” error.

func NewIntegerDivideTimeoutResponseBody

func NewIntegerDivideTimeoutResponseBody(res *goa.ServiceError) *IntegerDivideTimeoutResponseBody

NewIntegerDivideTimeoutResponseBody builds the HTTP response body from the result of the “integer_divide” endpoint of the “divider” 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 Server

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

Server lists the divider service endpoint HTTP handlers.

func New

func New(
    e *dividersvc.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 divider 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.


Generated by godoc2md