Skip to content

Commit 6f151a8

Browse files
committed
remove create session options
1 parent f8925e5 commit 6f151a8

File tree

2 files changed

+13
-30
lines changed

2 files changed

+13
-30
lines changed

internal/query/client.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,7 @@ func New(ctx context.Context, balancer grpc.ClientConnInterface, cfg *config.Con
304304
}
305305
defer cancelCreate()
306306

307-
s, err := createSession(createCtx, client.grpcClient, cfg,
308-
withSessionCheck(func(s *Session) bool {
309-
return true
310-
}),
311-
)
307+
s, err := createSession(createCtx, client.grpcClient, cfg)
312308
if err != nil {
313309
return nil, xerrors.WithStackTrace(err)
314310
}

internal/query/session.go

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,15 @@ import (
2121

2222
var _ query.Session = (*Session)(nil)
2323

24-
type (
25-
Session struct {
26-
cfg *config.Config
27-
id string
28-
nodeID int64
29-
grpcClient Ydb_Query_V1.QueryServiceClient
30-
statusCode statusCode
31-
closeOnce func(ctx context.Context) error
32-
checks []func(s *Session) bool
33-
}
34-
sessionOption func(session *Session)
35-
)
24+
type Session struct {
25+
cfg *config.Config
26+
id string
27+
nodeID int64
28+
grpcClient Ydb_Query_V1.QueryServiceClient
29+
statusCode statusCode
30+
closeOnce func(ctx context.Context) error
31+
checks []func(s *Session) bool
32+
}
3633

3734
func (s *Session) ReadRow(ctx context.Context, q string, opts ...options.ExecuteOption) (row query.Row, _ error) {
3835
_, r, err := s.Execute(ctx, q, opts...)
@@ -74,15 +71,9 @@ func (s *Session) ReadResultSet(ctx context.Context, q string, opts ...options.E
7471
return rs, nil
7572
}
7673

77-
func withSessionCheck(f func(*Session) bool) sessionOption {
78-
return func(s *Session) {
79-
s.checks = append(s.checks, f)
80-
}
81-
}
82-
83-
func createSession(
84-
ctx context.Context, client Ydb_Query_V1.QueryServiceClient, cfg *config.Config, opts ...sessionOption,
85-
) (s *Session, finalErr error) {
74+
func createSession(ctx context.Context, client Ydb_Query_V1.QueryServiceClient, cfg *config.Config) (
75+
s *Session, finalErr error,
76+
) {
8677
s = &Session{
8778
cfg: cfg,
8879
grpcClient: client,
@@ -94,10 +85,6 @@ func createSession(
9485
}
9586
}()
9687

97-
for _, opt := range opts {
98-
opt(s)
99-
}
100-
10188
onDone := trace.QueryOnSessionCreate(s.cfg.Trace(), &ctx,
10289
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.createSession"),
10390
)

0 commit comments

Comments
 (0)