@@ -20,46 +20,46 @@ import (
2020 "github.com/ydb-platform/ydb-go-sdk/v3/log"
2121 "github.com/ydb-platform/ydb-go-sdk/v3/ratelimiter"
2222 "github.com/ydb-platform/ydb-go-sdk/v3/scheme"
23+ "github.com/ydb-platform/ydb-go-sdk/v3/scripting"
2324 "github.com/ydb-platform/ydb-go-sdk/v3/table"
2425 tableConfig "github.com/ydb-platform/ydb-go-sdk/v3/table/config"
2526 "github.com/ydb-platform/ydb-go-sdk/v3/trace"
2627)
2728
29+ // Connection interface provide access to YDB service clients
30+ // Interface and list of clients may be changed in the future
2831type Connection interface {
2932 db.Connection
3033
3134 // Table returns table client with options from Connection instance.
3235 // Options provide options replacement for requested table client
33- // such as endpoint, database, secure connection flag and credentials
34- // Options replacement feature not implements now
36+ // such as database and access token
3537 Table (opts ... CustomOption ) table.Client
3638
3739 // Scheme returns scheme client with options from Connection instance.
3840 // Options provide options replacement for requested scheme client
39- // such as endpoint, database, secure connection flag and credentials
40- // Options replacement feature not implements now
41+ // such as database and access token
4142 Scheme (opts ... CustomOption ) scheme.Client
4243
4344 // Coordination returns coordination client with options from Connection instance.
4445 // Options provide options replacement for requested coordination client
45- // such as endpoint, database, secure connection flag and credentials
46- // Options replacement feature not implements now
46+ // such as database and access token
4747 Coordination (opts ... CustomOption ) coordination.Client
4848
4949 // Ratelimiter returns rate limiter client with options from Connection instance.
5050 // Options provide options replacement for requested rate limiter client
51- // such as endpoint, database, secure connection flag and credentials
52- // Options replacement feature not implements now
51+ // such as database and access token
5352 Ratelimiter (opts ... CustomOption ) ratelimiter.Client
5453
5554 // Discovery returns discovery client with options from Connection instance.
5655 // Options provide options replacement for requested discovery client
57- // such as endpoint, database, secure connection flag and credentials
58- // Options replacement feature not implements now
56+ // such as database and access token
5957 Discovery (opts ... CustomOption ) discovery.Client
6058
61- // Close clears resources and close all connections to YDB
62- Close (ctx context.Context ) error
59+ // Scripting returns scripting client with options from Connection instance.
60+ // Options provide options replacement for requested discovery client
61+ // such as database and access token
62+ Scripting (opts ... CustomOption ) scripting.Client
6363}
6464
6565type connection struct {
@@ -71,6 +71,7 @@ type connection struct {
7171 db db.Connection
7272 table table.Client
7373 scheme scheme.Client
74+ scripting scripting.Client
7475 discovery discovery.Client
7576 coordination coordination.Client
7677 rateLimiter ratelimiter.Client
@@ -95,9 +96,15 @@ func (c *connection) Close(ctx context.Context) error {
9596 if err := c .table .Close (ctx ); err != nil {
9697 issues = append (issues , err )
9798 }
99+ if err := c .scripting .Close (ctx ); err != nil {
100+ issues = append (issues , err )
101+ }
98102 if err := c .db .Close (ctx ); err != nil {
99103 issues = append (issues , err )
100104 }
105+ if err := c .conns .Close (ctx ); err != nil {
106+ issues = append (issues , err )
107+ }
101108 if len (issues ) > 0 {
102109 return errors .NewWithIssues ("close failed" , issues ... )
103110 }
@@ -170,6 +177,13 @@ func (c *connection) Discovery(opts ...CustomOption) discovery.Client {
170177 return proxy .Discovery (c .discovery , c .meta (opts ... ))
171178}
172179
180+ func (c * connection ) Scripting (opts ... CustomOption ) scripting.Client {
181+ if len (opts ) == 0 {
182+ return c .scripting
183+ }
184+ return proxy .Scripting (c .scripting , c .meta (opts ... ))
185+ }
186+
173187func (c * connection ) meta (opts ... CustomOption ) meta.Meta {
174188 if len (opts ) == 0 {
175189 return c .config .Meta ()
@@ -225,6 +239,7 @@ func New(ctx context.Context, opts ...Option) (_ Connection, err error) {
225239 }
226240 c .table = lazy .Table (c .db , c .tableOptions )
227241 c .scheme = lazy .Scheme (c .db )
242+ c .scripting = lazy .Scripting (c .db )
228243 c .discovery = lazy .Discovery (c .db , c .config .Trace ())
229244 c .coordination = lazy .Coordination (c .db )
230245 c .rateLimiter = lazy .Ratelimiter (c .db )
0 commit comments