(ctx context.Context)
| 27 | func WithQueryOrigin(ctx context.Context, kind QueryOriginKind) context.Context { |
| 28 | if ctx == nil { |
| 29 | ctx = context.Background() |
| 30 | } |
| 31 | return context.WithValue(ctx, queryOriginKey, kind) |
| 32 | } |
| 33 | |
| 34 | func QueryOrigin(ctx context.Context) QueryOriginKind { |
| 35 | if ctx == nil { |
| 36 | return UnknownQueryOrigin |
| 37 | } |
| 38 | if kind, ok := ctx.Value(queryOriginKey).(QueryOriginKind); ok { |
| 39 | return kind |
no test coverage detected