transport_grpc

package
v0.0.0-...-61829c1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContextKeyServerName = uuid.New().String()
)

Functions

func ClientIP

func ClientIP(ctx context.Context) string

func CodeFromHTTPStatus

func CodeFromHTTPStatus(status int) codes.Code

func ContextWithServiceName

func ContextWithServiceName(ctx context.Context, serverName string) context.Context

func CreateStreamHandler

func CreateStreamHandler(s *ServeGRPC, ops ...courier.IOperator) grpc.StreamHandler

func GetFieldDisplayName

func GetFieldDisplayName(field reflect.StructField) string

func HTTPStatusFromCode

func HTTPStatusFromCode(code codes.Code) int

func MarshalOperator

func MarshalOperator(stream grpc.ServerStream, operator courier.IOperator) error

func MsgPackUnmarshal

func MsgPackUnmarshal(data []byte, v interface{}) error

Types

type DecodeStreamFunc

type DecodeStreamFunc func(c context.Context, data []byte) (request interface{}, err error)

type GRPCRequest

type GRPCRequest struct {
	RequestID  string
	BaseURL    string
	ServerName string
	Method     string
	Timeout    time.Duration
	Req        interface{}
	Metadata   courier.Metadata
}

func (*GRPCRequest) Do

func (grpcRequest *GRPCRequest) Do() (result courier.Result)

type MockServer

type MockServer interface {
}

type MsgPackCodec

type MsgPackCodec struct {
}

func (*MsgPackCodec) Marshal

func (c *MsgPackCodec) Marshal(v interface{}) ([]byte, error)

func (*MsgPackCodec) String

func (c *MsgPackCodec) String() string

func (*MsgPackCodec) Unmarshal

func (c *MsgPackCodec) Unmarshal(data []byte, v interface{}) error

type ServeGRPC

type ServeGRPC struct {
	IP           string
	Port         int
	WriteTimeout time.Duration
	ReadTimeout  time.Duration
	Name         string
}

func (ServeGRPC) DockerDefaults

func (s ServeGRPC) DockerDefaults() conf.DockerDefaults

func (ServeGRPC) MarshalDefaults

func (s ServeGRPC) MarshalDefaults(v interface{})

func (*ServeGRPC) Serve

func (s *ServeGRPC) Serve(router *courier.Router) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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