Namespace returns the namespace from the context. The namespace is not guaranteed to be valid.
(ctx context.Context)
| 56 | // |
| 57 | // The namespace is not guaranteed to be valid. |
| 58 | func Namespace(ctx context.Context) (string, bool) { |
| 59 | namespace, ok := ctx.Value(namespaceKey{}).(string) |
| 60 | if !ok { |
| 61 | if namespace, ok = fromGRPCHeader(ctx); !ok { |
| 62 | return fromTTRPCHeader(ctx) |
| 63 | } |
| 64 | } |
| 65 | return namespace, ok |
| 66 | } |
| 67 | |
| 68 | // NamespaceRequired returns the valid namespace from the context or an error. |
| 69 | func NamespaceRequired(ctx context.Context) (string, error) { |
searching dependent graphs…