NewClient returns the client from the context if set, otherwise a new instance.
(ctx context.Context)
| 44 | |
| 45 | // NewClient returns the client from the context if set, otherwise a new instance. |
| 46 | func NewClient(ctx context.Context) Client { |
| 47 | if client, ok := ctx.Value(clientContextKey).(Client); ok && client != nil { |
| 48 | return client |
| 49 | } |
| 50 | return exoClient{} |
| 51 | } |
| 52 | |
| 53 | type exoClient struct{} |
| 54 |