parent
6e37678c34
commit
502ace5bc1
@ -0,0 +1,23 @@ |
||||
package meta |
||||
|
||||
import ( |
||||
"context" |
||||
"github.com/go-kratos/kratos/v2/metadata" |
||||
) |
||||
|
||||
const ( |
||||
XMdGlobalOperator = "x-md-global-operator" |
||||
XMdGlobalAppid = "x-md-global-appid" |
||||
XMdServiceName = "x-md-service-name" |
||||
) |
||||
|
||||
func Set(ctx context.Context, kv ...string) context.Context { |
||||
return metadata.AppendToClientContext(ctx, kv...) |
||||
} |
||||
|
||||
func Get(ctx context.Context, key string) string { |
||||
if meta, ok := metadata.FromClientContext(ctx); ok { |
||||
return meta.Get(key) |
||||
} |
||||
return "" |
||||
} |
Loading…
Reference in new issue