NewContext returns a new context with associated routing context. It does nothing and returns ctx if it already has associated routing context.
(ctx context.Context)
| 12 | // NewContext returns a new context with associated routing context. |
| 13 | // It does nothing and returns ctx if it already has associated routing context. |
| 14 | func NewContext(ctx context.Context) context.Context { |
| 15 | if _, ok := ctx.Value(routingContextKey).(*sync.Map); ok { |
| 16 | return ctx |
| 17 | } |
| 18 | return context.WithValue(ctx, routingContextKey, &sync.Map{}) |
| 19 | } |
| 20 | |
| 21 | // FromContext returns value from the routing context stored in ctx. |
| 22 | // It returns value associated with the key or stores result of the defaultValue call. |
no outgoing calls
searching dependent graphs…