handler

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCHandlersMgr

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

GRPCHandlersMgr 管理接口到方法的对应关系

func GetGRPCHandlersMgr

func GetGRPCHandlersMgr() *GRPCHandlersMgr

func (*GRPCHandlersMgr) GenerateHandler

func (s *GRPCHandlersMgr) GenerateHandler(methodInfo *MethodInfo) Handler

func (*GRPCHandlersMgr) GetHandlerById

func (s *GRPCHandlersMgr) GetHandlerById(id int32) (*MethodInfo, bool)

func (*GRPCHandlersMgr) GetHandlerByRouter

func (s *GRPCHandlersMgr) GetHandlerByRouter(url string) (*MethodInfo, bool)

func (*GRPCHandlersMgr) RangeURLHandlers

func (s *GRPCHandlersMgr) RangeURLHandlers(do func(md Metadata, handler Handler))

func (*GRPCHandlersMgr) RegisterMsg

func (s *GRPCHandlersMgr) RegisterMsg(msg interfaces.MsgDef)

func (*GRPCHandlersMgr) RegisterServer

func (s *GRPCHandlersMgr) RegisterServer(desc *grpc.ServiceDesc, srv interface{})

type Handler

type Handler func(ctx context.Context, dec func(interface{}) error) (interface{}, *gcodes.Code)

type Manager

type Manager interface {
	RangeURLHandlers(do func(md Metadata, handler Handler))
}

type Metadata

type Metadata struct {
	Cmd        int32
	Uri        string
	Srv        interface{}
	AuthType   int32
	HTTPMethod string
	Req        reflect.Type
	Rsp        reflect.Type
}

type MethodHandler

type MethodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error)

type MethodInfo

type MethodInfo struct {
	Metadata
	Handler MethodHandler
	Desc    *grpc.ServiceDesc
}

type Result

type Result interface {
	GetCode() int
	GetMsg() string
	GetData() proto.Message
}

Jump to

Keyboard shortcuts

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