grpcx

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcContext

type GrpcContext struct {
	*logx.LogContext
	*datax.MemoryContext
	*tracex.TraceContext
	*alarmx.AlarmContext
	// contains filtered or unexported fields
}

GrpcContext grpc context

func NewGrpcContext

func NewGrpcContext(name string, md metautils.NiceMD) *GrpcContext

NewGrpcContext newCtx

func (*GrpcContext) Deadline

func (c *GrpcContext) Deadline() (deadline time.Time, ok bool)

Deadline returns the time when work done on behalf of this contextx should be canceled. Deadline returns ok==false when no deadline is set. Successive calls to Deadline return the same results.

func (*GrpcContext) Done

func (c *GrpcContext) Done() <-chan struct{}

Done returns a channel that's closed when work done on behalf of this contextx should be canceled. Done may return nil if this contextx can never be canceled. Successive calls to Done return the same value.

func (*GrpcContext) Err

func (c *GrpcContext) Err() error

Err returns a non-nil error value after Done is closed, successive calls to Err return the same error. If Done is not yet closed, Err returns nil. If Done is closed, Err returns a non-nil error explaining why: Canceled if the contextx was canceled or DeadlineExceeded if the contextx's deadline passed.

func (*GrpcContext) Value

func (c *GrpcContext) Value(key interface{}) interface{}

Value returns the value associated with this contextx for key, or nil if no value is associated with key. Successive calls to Value with the same key returns the same result.

type GrpcServer

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

GrpcServer struct

func NewGrpcServer

func NewGrpcServer() *GrpcServer

NewGrpcServer create new GrpcServer with default configuration

func (*GrpcServer) Register

func (gs *GrpcServer) Register(f ...func(s *GrpcServer))

func (*GrpcServer) Run

func (gs *GrpcServer) Run(addr string) (err error)

func (*GrpcServer) Use

func (gs *GrpcServer) Use(f ...func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error))

Jump to

Keyboard shortcuts

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