Documentation ¶
Index ¶
Constants ¶
const ServiceName = "calc"
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 = [2]string{"divide", "add"}
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 MakeTimeout ¶
func MakeTimeout(err error) *goa.ServiceError
MakeTimeout builds a goa.ServiceError from an error.
func NewAddEndpoint ¶
NewAddEndpoint returns an endpoint function that calls the method "add" of service "calc".
func NewDivideEndpoint ¶
NewDivideEndpoint returns an endpoint function that calls the method "divide" of service "calc".
Types ¶
type AddPayload ¶
AddPayload is the payload type of the calc service add method.
type Client ¶
Client is the "calc" service client.
func (*Client) Add ¶
Add calls the "add" endpoint of the "calc" service. Add may return the following errors:
- "timeout" (type *goa.ServiceError)
- error: internal error
func (*Client) Divide ¶
func (c *Client) Divide(ctx context.Context, p *DividePayload) (res *DivideResult, err error)
Divide calls the "divide" endpoint of the "calc" service. Divide may return the following errors:
- "div_by_zero" (type *DivByZero): division by 0
- "timeout" (type *goa.ServiceError)
- error: internal error
type DivByZero ¶
type DivByZero struct { // division by zero leads to infinity. Message string }
DivByZero is the error returned when using value 0 as divisor.
func (*DivByZero) ErrorName
deprecated
ErrorName returns "DivByZero".
Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105
func (*DivByZero) GoaErrorName ¶
GoaErrorName returns "DivByZero".
type DividePayload ¶
DividePayload is the payload type of the calc service divide method.
type DivideResult ¶
DivideResult is the result type of the calc service divide method.
type Endpoints ¶
Endpoints wraps the "calc" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "calc" service with endpoints.
type Service ¶
type Service interface { // Divide implements divide. Divide(context.Context, *DividePayload) (res *DivideResult, err error) // Add implements add. Add(context.Context, *AddPayload) (res int, err error) }
Service is the calc service interface.