@@ -185,44 +185,44 @@ func (d *Driver) Secure() bool {
185185
186186// Table returns table client
187187func (d * Driver ) Table () table.Client {
188- return d .table .Get ()
188+ return d .table .Must ()
189189}
190190
191191// Query returns query client
192192//
193193// Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
194194func (d * Driver ) Query () * internalQuery.Client {
195- return d .query .Get ()
195+ return d .query .Must ()
196196}
197197
198198// Scheme returns scheme client
199199func (d * Driver ) Scheme () scheme.Client {
200- return d .scheme .Get ()
200+ return d .scheme .Must ()
201201}
202202
203203// Coordination returns coordination client
204204func (d * Driver ) Coordination () coordination.Client {
205- return d .coordination .Get ()
205+ return d .coordination .Must ()
206206}
207207
208208// Ratelimiter returns ratelimiter client
209209func (d * Driver ) Ratelimiter () ratelimiter.Client {
210- return d .ratelimiter .Get ()
210+ return d .ratelimiter .Must ()
211211}
212212
213213// Discovery returns discovery client
214214func (d * Driver ) Discovery () discovery.Client {
215- return d .discovery .Get ()
215+ return d .discovery .Must ()
216216}
217217
218218// Scripting returns scripting client
219219func (d * Driver ) Scripting () scripting.Client {
220- return d .scripting .Get ()
220+ return d .scripting .Must ()
221221}
222222
223223// Topic returns topic client
224224func (d * Driver ) Topic () topic.Client {
225- return d .topic .Get ()
225+ return d .topic .Must ()
226226}
227227
228228// Open connects to database by DSN and return driver runtime holder
@@ -407,7 +407,7 @@ func (d *Driver) connect(ctx context.Context) (err error) {
407407 return xerrors .WithStackTrace (err )
408408 }
409409
410- d .table = xsync .OnceValue (func () * internalTable.Client {
410+ d .table = xsync .OnceValue (func () ( * internalTable.Client , error ) {
411411 return internalTable .New (xcontext .ValueOnly (ctx ),
412412 d .balancer ,
413413 tableConfig .New (
@@ -419,10 +419,10 @@ func (d *Driver) connect(ctx context.Context) (err error) {
419419 d .tableOptions ... ,
420420 )... ,
421421 ),
422- )
422+ ), nil
423423 })
424424
425- d .query = xsync .OnceValue (func () * internalQuery.Client {
425+ d .query = xsync .OnceValue (func () ( * internalQuery.Client , error ) {
426426 return internalQuery .New (xcontext .ValueOnly (ctx ),
427427 d .balancer ,
428428 queryConfig .New (
@@ -434,13 +434,13 @@ func (d *Driver) connect(ctx context.Context) (err error) {
434434 d .queryOptions ... ,
435435 )... ,
436436 ),
437- )
437+ ), nil
438438 })
439439 if err != nil {
440440 return xerrors .WithStackTrace (err )
441441 }
442442
443- d .scheme = xsync .OnceValue (func () * internalScheme.Client {
443+ d .scheme = xsync .OnceValue (func () ( * internalScheme.Client , error ) {
444444 return internalScheme .New (xcontext .ValueOnly (ctx ),
445445 d .balancer ,
446446 schemeConfig .New (
@@ -453,10 +453,10 @@ func (d *Driver) connect(ctx context.Context) (err error) {
453453 d .schemeOptions ... ,
454454 )... ,
455455 ),
456- )
456+ ), nil
457457 })
458458
459- d .coordination = xsync .OnceValue (func () * internalCoordination.Client {
459+ d .coordination = xsync .OnceValue (func () ( * internalCoordination.Client , error ) {
460460 return internalCoordination .New (xcontext .ValueOnly (ctx ),
461461 d .balancer ,
462462 coordinationConfig .New (
@@ -468,10 +468,10 @@ func (d *Driver) connect(ctx context.Context) (err error) {
468468 d .coordinationOptions ... ,
469469 )... ,
470470 ),
471- )
471+ ), nil
472472 })
473473
474- d .ratelimiter = xsync .OnceValue (func () * internalRatelimiter.Client {
474+ d .ratelimiter = xsync .OnceValue (func () ( * internalRatelimiter.Client , error ) {
475475 return internalRatelimiter .New (xcontext .ValueOnly (ctx ),
476476 d .balancer ,
477477 ratelimiterConfig .New (
@@ -483,10 +483,10 @@ func (d *Driver) connect(ctx context.Context) (err error) {
483483 d .ratelimiterOptions ... ,
484484 )... ,
485485 ),
486- )
486+ ), nil
487487 })
488488
489- d .discovery = xsync .OnceValue (func () * internalDiscovery.Client {
489+ d .discovery = xsync .OnceValue (func () ( * internalDiscovery.Client , error ) {
490490 return internalDiscovery .New (xcontext .ValueOnly (ctx ),
491491 d .pool .Get (endpoint .New (d .config .Endpoint ())),
492492 discoveryConfig .New (
@@ -502,10 +502,10 @@ func (d *Driver) connect(ctx context.Context) (err error) {
502502 d .discoveryOptions ... ,
503503 )... ,
504504 ),
505- )
505+ ), nil
506506 })
507507
508- d .scripting = xsync .OnceValue (func () * internalScripting.Client {
508+ d .scripting = xsync .OnceValue (func () ( * internalScripting.Client , error ) {
509509 return internalScripting .New (xcontext .ValueOnly (ctx ),
510510 d .balancer ,
511511 scriptingConfig .New (
@@ -517,10 +517,10 @@ func (d *Driver) connect(ctx context.Context) (err error) {
517517 d .scriptingOptions ... ,
518518 )... ,
519519 ),
520- )
520+ ), nil
521521 })
522522
523- d .topic = xsync .OnceValue (func () * topicclientinternal.Client {
523+ d .topic = xsync .OnceValue (func () ( * topicclientinternal.Client , error ) {
524524 return topicclientinternal .New (xcontext .ValueOnly (ctx ),
525525 d .balancer ,
526526 d .config .Credentials (),
@@ -532,7 +532,7 @@ func (d *Driver) connect(ctx context.Context) (err error) {
532532 },
533533 d .topicOptions ... ,
534534 )... ,
535- )
535+ ), nil
536536 })
537537
538538 return nil
0 commit comments