service

package
v0.0.0-...-4636cf4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGetEmployeeCustomRouter

func AddGetEmployeeCustomRouter(r *mux.Router, handler http.Handler) *mux.Router

func DecodeGetEmployeeRequest

func DecodeGetEmployeeRequest(_ context.Context, r *http.Request) (request interface{}, err error)

func EncodeResponse

func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error

func MakeGetEmployeeEndpoint

func MakeGetEmployeeEndpoint(s IService) endpoint.Endpoint

func MakeGetEmployeeHandler

func MakeGetEmployeeHandler(ep endpoint.Endpoint, options ...httptransport.ServerOption) *httptransport.Server

func NewGetEmployeeEndpoint

func NewGetEmployeeEndpoint(url *url.URL, options ...httptransport.ClientOption) endpoint.Endpoint

func NewRouter

func NewRouter(svc IService, options ...httptransport.ServerOption) *mux.Router

Types

type Client

type Client struct {
	GetEmployeeEndpoint endpoint.Endpoint
	Host                *url.URL
}

func NewHTTPClient

func NewHTTPClient(baseURL string, options ...ClientOption) (*Client, error)

func (*Client) GetEmployee

func (c *Client) GetEmployee(ctx context.Context, req GetEmployeeRequest, options ...RequestOption) (*Employee, error)

method name given from operationId parameter

type ClientOption

type ClientOption func(c *Client)

type Company

type Company struct {
	UUID string `json:"uuid"`
	Name string `json:"name"`
}

type Employee

type Employee struct {
	UUID    string   `json:"uuid"`
	Email   string   `json:"email"`
	Phone   string   `json:"phone"`
	Company *Company `json:"company"`
}

type Endpoints

type Endpoints struct {
	GetEmployeeEndpoint endpoint.Endpoint
}

func MakeEndoints

func MakeEndoints(s IService) Endpoints

func (Endpoints) GetEmployee

func (e Endpoints) GetEmployee(ctx context.Context, phone string) (Employee, error)

type GetEmployeeRequest

type GetEmployeeRequest struct {
	Phone string `json:"phone"`
}

type GetEmployeeResp204

type GetEmployeeResp204 struct{}

func (*GetEmployeeResp204) Error

func (e *GetEmployeeResp204) Error() string

type GetEmployeeResp400

type GetEmployeeResp400 struct {
	ErrCode int    `json:"err_code"`
	Msg     string `json:"msg"`
}

func (*GetEmployeeResp400) Error

func (e *GetEmployeeResp400) Error() string

type GetEmployeeResp500

type GetEmployeeResp500 struct{}

func (*GetEmployeeResp500) Error

func (e *GetEmployeeResp500) Error() string

type GetEmployeeResponse

type GetEmployeeResponse struct {
	Employee Employee `json:"employee,omitempty"`
	Err      error    `json:"err,omitempty"`
}

func (*GetEmployeeResponse) Error

func (r *GetEmployeeResponse) Error() error

type IService

type IService interface {
	GetEmployee(ctx context.Context, phone string) (Employee, error)
}

IService - implement business logic interface

type RequestOption

type RequestOption func(req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL