diff --git a/client_context.go b/client_context.go new file mode 100644 index 0000000..4cffe51 --- /dev/null +++ b/client_context.go @@ -0,0 +1,18 @@ +package runtime + +import "context" + +type operationIdKey int + +const key = operationIdKey(0) + +func WithOperationId(ctx context.Context, operationId string) context.Context { + return context.WithValue(ctx, key, operationId) +} + +func GetOperationId(ctx context.Context) string { + if operationId, ok := ctx.Value(key).(string); ok { + return operationId + } + return "" +}