Documentation ¶
Overview ¶
本包提供了增强的context
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithValue ¶
WithValue返回带有m的所有key,value的context.Context
Example (Map) ¶
m1 := make(map[interface{}]interface{}) m1["a"] = "b" ctx := WithValue(context.Background(), GoMap(m1)) fmt.Println(ctx.Value("a"))
Output: b
Example (SyncMap) ¶
var m1 sync.Map m1.Store("a", "b") ctx := WithValue(context.Background(), &m1) fmt.Println(ctx.Value("a"))
Output: b
Types ¶
Click to show internal directories.
Click to hide internal directories.