************************************/ ******** METADATA MANAGEMENT********/ ************************************/ Set is used to store a new key/value pair exclusively for this context. It also lazy initializes c.Keys if it was not used previously.
(key any, value any)
| 274 | // Set is used to store a new key/value pair exclusively for this context. |
| 275 | // It also lazy initializes c.Keys if it was not used previously. |
| 276 | func (c *Context) Set(key any, value any) { |
| 277 | c.mu.Lock() |
| 278 | defer c.mu.Unlock() |
| 279 | if c.Keys == nil { |
| 280 | c.Keys = make(map[any]any) |
| 281 | } |
| 282 | |
| 283 | c.Keys[key] = value |
| 284 | } |
| 285 | |
| 286 | // Get returns the value for the given key, ie: (value, true). |
| 287 | // If the value does not exist it returns (nil, false) |
no outgoing calls