mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-08-03 09:48:08 -04:00

Imports a patch previously exclusive to Botstopper. Signed-off-by: Xe Iaso <me@xeiaso.net>
15 lines
282 B
Go
15 lines
282 B
Go
package thoth
|
|
|
|
import "context"
|
|
|
|
type ctxKey struct{}
|
|
|
|
func With(ctx context.Context, cli *Client) context.Context {
|
|
return context.WithValue(ctx, ctxKey{}, cli)
|
|
}
|
|
|
|
func FromContext(ctx context.Context) (*Client, bool) {
|
|
cli, ok := ctx.Value(ctxKey{}).(*Client)
|
|
return cli, ok
|
|
}
|