cherryContext

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageIdKey       = "message_id"        // (客户端)消息id
	BuildPacketTimeKey = "build_packet_time" // 创建数据包时间
	InHandlerTimeKey   = "in_handler_time"   // 进入handler时间
)

Variables

View Source
var PropagateCtxKey = propagateKey{}

PropagateCtxKey is the context key where the content that will be propagated through rpc calls is set

Functions

func Add

func Add(ctx context.Context, key string, val interface{}) context.Context

Add adds a key and value that will be propagated through RPC calls

func Decode

func Decode(m []byte) context.Context

Decode returns a context given a binary encoded message

func Encode

func Encode(ctx context.Context) []byte

Encode returns the given propagatable context encoded in binary format

func FromMap

func FromMap(val map[string]interface{}) context.Context

FromMap creates a new context from a map with propagated values

func Get

func Get(ctx context.Context, key string) interface{}

Get get a value from the propagate

func GetBuildPacketTime added in v1.2.10

func GetBuildPacketTime(ctx context.Context) int64

func GetInHandlerTime added in v1.2.10

func GetInHandlerTime(ctx context.Context) int64

func GetInt64 added in v1.2.10

func GetInt64(ctx context.Context, key string) int64

func GetMessageId

func GetMessageId(ctx context.Context) uint

func New added in v1.2.10

func New() context.Context

func ToMap

func ToMap(ctx context.Context) map[string]interface{}

ToMap returns the values that will be propagated through RPC calls in map[string]interface{} format

Types

This section is empty.

Jump to

Keyboard shortcuts

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