rpc

package
v0.0.0-...-cc17c53 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSON

func DecodeJSON(r io.Reader, v interface{}) error

func HandleResponseErr

func HandleResponseErr(resp *http.Response) error

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, msg interface{})

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{}) error

Types

type Api

type Api struct {
	Endpoints []EndPoint
}

func (*Api) AddEndpoint

func (a *Api) AddEndpoint(e EndPoint)

func (Api) Routes

func (api Api) Routes() *mux.Router

type Client

type Client interface {
	Do(*http.Request) (*http.Response, error)
}

type EndPoint

type EndPoint struct {
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(path, methodType string, handler http.HandlerFunc) EndPoint

type HTTPService

type HTTPService struct {
	// contains filtered or unexported fields
}

func NewHTTPService

func NewHTTPService(port int, api *Api, l *logrus.Entry) HTTPService

func (*HTTPService) Start

func (service *HTTPService) Start()

func (*HTTPService) Stop

func (service *HTTPService) Stop() error

type Server

type Server interface {
	ListenAndServe() error
	Shutdown(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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