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


dividersvc

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

Overview

Index

Package files

client.go endpoints.go service.go

Constants

const ServiceName = "divider"

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{"integer_divide", "divide"}

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.

func MakeDivByZero

func MakeDivByZero(err error) *goa.ServiceError

MakeDivByZero builds a goa.ServiceError from an error.

func MakeHasRemainder

func MakeHasRemainder(err error) *goa.ServiceError

MakeHasRemainder builds a goa.ServiceError from an error.

func MakeTimeout

func MakeTimeout(err error) *goa.ServiceError

MakeTimeout builds a goa.ServiceError from an error.

func NewDivideEndpoint

func NewDivideEndpoint(s Service) goa.Endpoint

NewDivideEndpoint returns an endpoint function that calls the method “divide” of service “divider”.

func NewIntegerDivideEndpoint

func NewIntegerDivideEndpoint(s Service) goa.Endpoint

NewIntegerDivideEndpoint returns an endpoint function that calls the method “integer_divide” of service “divider”.

type Client

type Client struct {
    IntegerDivideEndpoint goa.Endpoint
    DivideEndpoint        goa.Endpoint
}

Client is the “divider” service client.

func NewClient

func NewClient(integerDivide, divide goa.Endpoint) *Client

NewClient initializes a “divider” service client given the endpoints.

func (*Client) Divide

func (c *Client) Divide(ctx context.Context, p *FloatOperands) (res float64, err error)

Divide calls the “divide” endpoint of the “divider” service.

func (*Client) IntegerDivide

func (c *Client) IntegerDivide(ctx context.Context, p *IntOperands) (res int, err error)

IntegerDivide calls the “integer_divide” endpoint of the “divider” service. IntegerDivide may return the following errors:

- "has_remainder" (type *goa.ServiceError): integer division has remainder
- error: internal error

type Endpoints

type Endpoints struct {
    IntegerDivide goa.Endpoint
    Divide        goa.Endpoint
}

Endpoints wraps the “divider” service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the “divider” service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the “divider” service endpoints.

type FloatOperands

type FloatOperands struct {
    // Left operand
    A float64
    // Right operand
    B float64
}

FloatOperands is the payload type of the divider service divide method.

type IntOperands

type IntOperands struct {
    // Left operand
    A int
    // Right operand
    B int
}

IntOperands is the payload type of the divider service integer_divide method.

type Service

type Service interface {
    // IntegerDivide implements integer_divide.
    IntegerDivide(context.Context, *IntOperands) (res int, err error)
    // Divide implements divide.
    Divide(context.Context, *FloatOperands) (res float64, err error)
}

Service is the divider service interface.


Generated by godoc2md