grpc

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 20 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterceptorLogger added in v0.0.5

func InterceptorLogger(l *slog.Logger) logging.Logger

InterceptorLogger adapts slog logger to interceptor logger. This code is simple enough to be copied and not imported.

Types

type Option

type Option func(*Options)

Option set options

func WithAddr

func WithAddr(s string) Option

WithAddr set AddrOption

func WithCert

func WithCert(s string) Option

WithCert 设置cert

func WithContext

func WithContext(c context.Context) Option

WithContext set ContextOption

func WithDomain

func WithDomain(s string) Option

WithDomain set DomainOption

func WithID

func WithID(s string) Option

WithID set IDOption

func WithKeepAlive

func WithKeepAlive(t time.Duration) Option

WithKeepAlive set KeepAliveOption

func WithKey

func WithKey(s string) Option

WithKey 设置key

func WithMaxConcurrentStreamsOption

func WithMaxConcurrentStreamsOption(i int) Option

WithMaxConcurrentStreamsOption set MaxConcurrentStreamsOption

func WithMaxConnectionAge

func WithMaxConnectionAge(t time.Duration) Option

WithMaxConnectionAge set MaxConnectionAgeOption

func WithMaxConnectionAgeGrace

func WithMaxConnectionAgeGrace(t time.Duration) Option

WithMaxConnectionAgeGrace set MaxConnectionAgeGraceOption

func WithMaxMsgSizeOption

func WithMaxMsgSizeOption(i int) Option

WithMaxMsgSizeOption set MaxMsgSizeOption

func WithStreamServerInterceptors

func WithStreamServerInterceptors(u ...grpc.StreamServerInterceptor) Option

WithStreamServerInterceptors set StreamServerInterceptorsOption

func WithTLS

func WithTLS(tls *tls.Config) Option

WithTLS set TlsOption

func WithTimeout

func WithTimeout(t time.Duration) Option

WithTimeout set TimeoutOption

func WithUnaryServerInterceptors

func WithUnaryServerInterceptors(u ...grpc.UnaryServerInterceptor) Option

WithUnaryServerInterceptors set UnaryServerInterceptorsOption

type Options

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

Options options

type Server

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

Server server

func New

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

New grpc server

func (*Server) NewServer

func (e *Server) NewServer()

NewServer new a server

func (*Server) Options

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

Options set options

func (*Server) Register

func (e *Server) Register(do func(server *Server))

Register register

func (*Server) Server

func (e *Server) Server() *grpc.Server

Server return server

func (*Server) Shutdown

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

Shutdown shutdown

func (*Server) Start

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

Start run

func (*Server) String

func (e *Server) String() string

String string

type Service

type Service struct {
	Connection  *grpc.ClientConn
	CallTimeout time.Duration
}

Service service client

func (*Service) Dial

func (e *Service) Dial(
	endpoint string,
	callTimeout time.Duration,
	unary ...grpc.UnaryClientInterceptor) (err error)

Dial dial

Jump to

Keyboard shortcuts

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