AttachNamespace adds given namespace to the metadata of the context.
(ctx context.Context, namespace uint64)
| 465 | |
| 466 | // AttachNamespace adds given namespace to the metadata of the context. |
| 467 | func AttachNamespace(ctx context.Context, namespace uint64) context.Context { |
| 468 | md, ok := metadata.FromIncomingContext(ctx) |
| 469 | if !ok { |
| 470 | md = metadata.New(nil) |
| 471 | } |
| 472 | ns := strconv.FormatUint(namespace, 10) |
| 473 | md.Set("namespace", ns) |
| 474 | return metadata.NewIncomingContext(ctx, md) |
| 475 | } |
| 476 | |
| 477 | // AttachJWTNamespaceOutgoing attaches the namespace in the JWT claims to the outgoing metadata of |
| 478 | // the context. |
no test coverage detected