grpc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialOpts

func DialOpts() []grpc.DialOption

func ServerOpts

func ServerOpts() []grpc.ServerOption

func UnaryClientTimeout

func UnaryClientTimeout(defaultTime time.Duration) grpc.UnaryClientInterceptor

func UnaryClientTraceID

func UnaryClientTraceID() grpc.UnaryClientInterceptor

func UnaryServerTimeout

func UnaryServerTimeout(timeout time.Duration) middleware.Middleware

func UnaryServerTracID

func UnaryServerTracID() middleware.Middleware

Types

type Client

type Client struct {
	*grpc.ClientConn
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...ClientOption) *Client

func (*Client) Stop

func (c *Client) Stop() error

type ClientObj

type ClientObj struct {
	Name string
	Addr string
}

type ClientOption

type ClientOption func(*Client)

func ClientOptions

func ClientOptions(opts []grpc.DialOption) ClientOption

func WithAddr

func WithAddr(addr string) ClientOption

func WithMiddle

func WithMiddle(mw []middleware.Middleware) ClientOption

func WithStreamInterceptor

func WithStreamInterceptor(stream []grpc.StreamClientInterceptor) ClientOption

func WithTimeout

func WithTimeout(tm time.Duration) ClientOption

func WithUnaryInterceptor

func WithUnaryInterceptor(unary []grpc.UnaryClientInterceptor) ClientOption

type DialOption

type DialOption func() []grpc.DialOption

type GRPCClient

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

func NewGRPCClient

func NewGRPCClient(objs []*ClientObj, f DialOption, opts ...ClientOption) *GRPCClient

func (*GRPCClient) GetGRPCClient

func (c *GRPCClient) GetGRPCClient(name string) *Client

func (*GRPCClient) Stop

func (c *GRPCClient) Stop()

type RegisterObj

type RegisterObj struct {
	Obj      interface{}
	Register func(s *grpc.Server, obj interface{})
}

func (*RegisterObj) NewGRPCServer

func (r *RegisterObj) NewGRPCServer(opts ...ServerOption) *Server

type Server

type Server struct {
	*grpc.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

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

type ServerOption

type ServerOption func(*Server)

func Address

func Address(addr string) ServerOption

func Listener

func Listener(l net.Listener) ServerOption

func Logger

func Logger(logger logger.Logger) ServerOption

func Middleware

func Middleware(mw []middleware.Middleware) ServerOption

func Network

func Network(network string) ServerOption

func ServerOptions

func ServerOptions(opts []grpc.ServerOption) ServerOption

func StreamInterceptor

func StreamInterceptor(s []grpc.StreamServerInterceptor) ServerOption

func UnaryInterceptor

func UnaryInterceptor(u []grpc.UnaryServerInterceptor) ServerOption

Jump to

Keyboard shortcuts

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