rpc

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const Type string = "rpc"

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option 参数设置类型

func Log added in v0.1.15

func Log(opts ...log.ServerOption) Option

Log 设置日志配置

func WithAddr added in v0.5.2

func WithAddr(addr string) Option

WithAddr 设置服务地址

func WithConfig

func WithConfig(config config.Config) Option

WithStartedHook 设置启动回调函数

func WithDecodeRequestFunc added in v0.5.1

func WithDecodeRequestFunc(decReq engine.DecodeRequestFunc) Option

WithDecodeRequestFunc 解析入参

func WithEncodeErrorFunc added in v0.5.1

func WithEncodeErrorFunc(encErr engine.EncodeErrorFunc) Option

WithEncodeErrorFunc 编码错误

func WithEncodeResponseFunc added in v0.5.1

func WithEncodeResponseFunc(encResp engine.EncodeResponseFunc) Option

WithEncodeResponseFunc 编码响应

func WithEndHook added in v0.1.1

func WithEndHook(f engine.Hook) Option

func WithEngine added in v0.5.2

func WithEngine(engine string) Option

WithEngine 设置服务引擎(gin)

func WithServiceName added in v0.1.1

func WithServiceName(serviceName string) Option

WithServiceName 设置服务名称

func WithStartedHook added in v0.1.1

func WithStartedHook(f engine.Hook) Option

WithStartedHook 设置启动回调函数

type Server

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

func New

func New(name string, opts ...Option) *Server

New 实例化

func (*Server) Attempt

func (e *Server) Attempt() bool

Attempt 判断是否可以启动

func (*Server) Config

func (e *Server) Config(cfg config.Config)

func (*Server) Endpoint

func (e *Server) Endpoint() *url.URL

func (*Server) Group

func (e *Server) Group(group string, middlewares ...middleware.Middleware) *engine.RouterGroup

func (*Server) Handle

func (e *Server) Handle(path string, obj interface{}, opts ...engine.RouterOption)

func (*Server) Name

func (e *Server) Name() string

func (*Server) Options

func (e *Server) Options(opts ...Option)

Options 设置参数

func (*Server) RouterPathList added in v0.5.11

func (s *Server) RouterPathList() transport.RouterList

获取树形的路径列表

func (*Server) ServiceName added in v0.1.1

func (s *Server) ServiceName() string

ServiceName 服务名称

func (*Server) Start

func (e *Server) Start(ctx context.Context) (err error)

Start 开始

func (*Server) Stop

func (e *Server) Stop(ctx context.Context) error

Shutdown 停止

func (*Server) Type

func (e *Server) Type() string

func (*Server) Use

func (e *Server) Use(middlewares ...middleware.Middleware)

Jump to

Keyboard shortcuts

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