water

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 5 Imported by: 6

README

water

上善若水,水善利万物而不争

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodeRequestFunc

type DecodeRequestFunc func(context.Context, interface{}) (request interface{}, err error)

DecodeRequestFunc extracts a user-domain request object from a gRPC request. It's designed to be used in gRPC servers, for server-side endpoints. One straightforward DecodeRequestFunc could be something that decodes from the gRPC request message to the concrete request type.

type EncodeResponseFunc

type EncodeResponseFunc func(context.Context, interface{}) (response interface{}, err error)

EncodeResponseFunc encodes the passed response object to the gRPC response message. It's designed to be used in gRPC servers, for server-side endpoints. One straightforward EncodeResponseFunc could be something that encodes the object directly to the gRPC response message.

type Endpoint

type Endpoint func(ctx *gin.Context, req interface{}) (interface{}, error)

type ErrorHandler

type ErrorHandler interface {
	Handle(ctx *gin.Context, err error)
}

type ErrorHandlerFunc

type ErrorHandlerFunc func(ctx context.Context, err error)

func (ErrorHandlerFunc) Handle

func (f ErrorHandlerFunc) Handle(ctx context.Context, err error)

type Handler

type Handler interface {
	ServeGin(ctx *gin.Context, req interface{}) (interface{}, error)
}

type LogErrorHandler

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

func NewLogErrorHandler

func NewLogErrorHandler(l *zap.Logger) *LogErrorHandler

func (*LogErrorHandler) Handle

func (h *LogErrorHandler) Handle(ctx *gin.Context, err error)

type Server

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

func NewHandler

func NewHandler(svc Service, options ...ServerOption) *Server

func NewServer

func NewServer(e Endpoint, options ...ServerOption) *Server

func (Server) ServeGin added in v0.0.4

func (s Server) ServeGin(ctx *gin.Context, req interface{}) (interface{}, error)

type ServerFinalizerFunc

type ServerFinalizerFunc func(ctx context.Context, err error)

type ServerOption

type ServerOption func(*Server)

func ServerErrorHandler added in v0.0.5

func ServerErrorHandler(errorHandler ErrorHandler) ServerOption

func ServerFinalizer added in v0.0.5

func ServerFinalizer(f ...ServerFinalizerFunc) ServerOption

type Service

type Service interface {
	Endpoint() Endpoint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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