github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/meta/context.go (about) 1 package meta 2 3 import ( 4 "context" 5 6 "google.golang.org/grpc/metadata" 7 8 "github.com/ydb-platform/ydb-go-sdk/v3/internal/meta" 9 ) 10 11 // WithTraceID returns a copy of parent context with traceID 12 func WithTraceID(ctx context.Context, traceID string) context.Context { 13 return meta.WithTraceID(ctx, traceID) 14 } 15 16 // WithUserAgent returns a copy of parent context with custom user-agent info 17 func WithUserAgent(ctx context.Context, userAgent string) context.Context { 18 return meta.WithUserAgent(ctx, userAgent) 19 } 20 21 // WithRequestType returns a copy of parent context with custom request type 22 func WithRequestType(ctx context.Context, requestType string) context.Context { 23 return meta.WithRequestType(ctx, requestType) 24 } 25 26 // WithAllowFeatures returns a copy of parent context with allowed client feature 27 func WithAllowFeatures(ctx context.Context, features ...string) context.Context { 28 return meta.WithAllowFeatures(ctx, features) 29 } 30 31 // WithTrailerCallback attaches callback to context for listening incoming metadata 32 func WithTrailerCallback( 33 ctx context.Context, 34 callback func(md metadata.MD), 35 ) context.Context { 36 return meta.WithTrailerCallback(ctx, callback) 37 }