File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,17 @@ import (
66 "google.golang.org/grpc/metadata"
77)
88
9- // WithTraceID returns a copy of parent deadline with traceID
9+ // WithTraceID returns a copy of parent context with traceID
1010func WithTraceID (ctx context.Context , traceID string ) context.Context {
1111 return metadata .AppendToOutgoingContext (ctx , HeaderTraceID , traceID )
1212}
1313
14- // WithUserAgent returns a copy of parent deadline with custom user-agent info
14+ // WithUserAgent returns a copy of parent context with custom user-agent info
1515func WithUserAgent (ctx context.Context , userAgent string ) context.Context {
1616 return metadata .AppendToOutgoingContext (ctx , HeaderUserAgent , userAgent )
1717}
18+
19+ // WithRequestType returns a copy of parent context with custom request type
20+ func WithRequestType (ctx context.Context , requestType string ) context.Context {
21+ return metadata .AppendToOutgoingContext (ctx , HeaderRequestType , requestType )
22+ }
Original file line number Diff line number Diff line change 1+ package ydb
2+
3+ import (
4+ "context"
5+
6+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/meta"
7+ )
8+
9+ // WithTraceID returns a copy of parent context with traceID
10+ func WithTraceID (ctx context.Context , traceID string ) context.Context {
11+ return meta .WithTraceID (ctx , traceID )
12+ }
13+
14+ // WithRequestType returns a copy of parent context with custom request type
15+ func WithRequestType (ctx context.Context , requestType string ) context.Context {
16+ return meta .WithRequestType (ctx , requestType )
17+ }
Original file line number Diff line number Diff line change @@ -61,6 +61,13 @@ func WithUserAgent(userAgent string) Option {
6161 }
6262}
6363
64+ func WithRequestsType (requestsType string ) Option {
65+ return func (ctx context.Context , c * connection ) error {
66+ c .options = append (c .options , config .WithRequestsType (requestsType ))
67+ return nil
68+ }
69+ }
70+
6471// WithConnectionString accept connection string like 'grpc[s]://{endpoint}/?database={database}'
6572func WithConnectionString (connectionString string ) Option {
6673 return func (ctx context.Context , c * connection ) error {
You can’t perform that action at this time.
0 commit comments