12345678910111213141516171819202122232425262728293031323334 |
- package plugin
- import (
- "context"
- )
- type key int
- const (
- reqidKey key = 0
- )
- func NewReqidContext(ctx context.Context, reqid string) context.Context {
- return context.WithValue(ctx, reqidKey, reqid)
- }
- func GetReqidFromContext(ctx context.Context) string {
- ret, _ := ctx.Value(reqidKey).(string)
- return ret
- }
|