WithClient returns a copy of given context with the included client.
(ctx context.Context, client Client)
| 39 | |
| 40 | // WithClient returns a copy of given context with the included client. |
| 41 | func WithClient(ctx context.Context, client Client) context.Context { |
| 42 | return context.WithValue(ctx, clientContextKey, client) |
| 43 | } |
| 44 | |
| 45 | // NewClient returns the client from the context if set, otherwise a new instance. |
| 46 | func NewClient(ctx context.Context) Client { |
no outgoing calls