SetAuditWorkspaceID records the workspace that the current request should be audited against, if the audit interceptor registered a setter on the context. Safe to call even when auditing is disabled for the current method.
(ctx context.Context, workspaceID string)
| 41 | // audited against, if the audit interceptor registered a setter on the context. |
| 42 | // Safe to call even when auditing is disabled for the current method. |
| 43 | func SetAuditWorkspaceID(ctx context.Context, workspaceID string) { |
| 44 | if workspaceID == "" { |
| 45 | return |
| 46 | } |
| 47 | setter, ok := ctx.Value(AuditWorkspaceIDKey).(func(string)) |
| 48 | if !ok { |
| 49 | return |
| 50 | } |
| 51 | setter(workspaceID) |
| 52 | } |
| 53 | |
| 54 | // GetWorkspaceIDFromContext returns the workspace ID from the request context. |
| 55 | func GetWorkspaceIDFromContext(ctx context.Context) string { |
no outgoing calls
no test coverage detected