Documentation ¶
Index ¶
- Variables
- func DtmGrpcCall(s *dtmimp.TransBase, operation string) error
- func GetDtmMetaFromContext(ctx context.Context, name string) string
- func GetDtmRequest(s *dtmimp.TransBase) *dtmgpb.DtmRequest
- func GetGrpcConn(grpcServer string, isRaw bool) (conn *grpc.ClientConn, rerr error)
- func GetMetaFromContext(ctx context.Context, name string) string
- func GrpcClientLog(ctx context.Context, method string, req, reply interface{}, ...) error
- func GrpcServerLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func InvokeBranch(t *dtmimp.TransBase, isRaw bool, msg proto.Message, url string, ...) error
- func LogDtmCtx(ctx context.Context)
- func Map2Kvs(m map[string]string) []string
- func MustGetDtmClient(grpcServer string) dtmgpb.DtmClient
- func MustGetGrpcConn(grpcServer string, isRaw bool) *grpc.ClientConn
- func MustProtoMarshal(msg proto.Message) []byte
- func MustProtoUnmarshal(data []byte, msg proto.Message)
- func RequestTimeoutFromContext(ctx context.Context) int64
- func RequestTimeoutNewContext(ctx context.Context, requestTimeout int64) context.Context
- func TransBaseFromGrpc(ctx context.Context) *dtmimp.TransBase
- func TransInfo2Ctx(ctx context.Context, gid, transType, branchID, op, dtm string) context.Context
Constants ¶
This section is empty.
Variables ¶
var ClientInterceptors = []grpc.UnaryClientInterceptor{}
ClientInterceptors declares grpc.UnaryClientInterceptors slice
Functions ¶
func DtmGrpcCall ¶
DtmGrpcCall make a convenient call to dtm
func GetDtmMetaFromContext ¶
GetDtmMetaFromContext get dtm header from context
func GetDtmRequest ¶
func GetDtmRequest(s *dtmimp.TransBase) *dtmgpb.DtmRequest
GetDtmRequest return a DtmRequest from TransBase
func GetGrpcConn ¶
func GetGrpcConn(grpcServer string, isRaw bool) (conn *grpc.ClientConn, rerr error)
GetGrpcConn 1
func GetMetaFromContext ¶
GetMetaFromContext get header from context
func GrpcClientLog ¶
func GrpcClientLog(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
GrpcClientLog middleware to print client-side grpc log
func GrpcServerLog ¶
func GrpcServerLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
GrpcServerLog middleware to print server-side grpc log
func InvokeBranch ¶
func InvokeBranch(t *dtmimp.TransBase, isRaw bool, msg proto.Message, url string, reply interface{}, branchID string, op string, opts ...grpc.CallOption) error
InvokeBranch invoke a url for trans
func MustGetDtmClient ¶
MustGetDtmClient 1
func MustGetGrpcConn ¶
func MustGetGrpcConn(grpcServer string, isRaw bool) *grpc.ClientConn
MustGetGrpcConn 1
func MustProtoMarshal ¶
MustProtoMarshal must version of proto.Marshal
func MustProtoUnmarshal ¶
MustProtoUnmarshal must version of proto.Unmarshal
func RequestTimeoutFromContext ¶
RequestTimeoutFromContext returns requestTime of transOption option
func RequestTimeoutNewContext ¶
RequestTimeoutNewContext sets requestTimeout of transOption option to context
func TransBaseFromGrpc ¶
TransBaseFromGrpc get trans base info from a context metadata
Types ¶
This section is empty.