@@ -6,48 +6,16 @@ package ydb_test
66import (
77 "context"
88 "errors"
9- "fmt"
109 "testing"
1110 "time"
1211
1312 "github.com/stretchr/testify/require"
1413 grpcCodes "google.golang.org/grpc/codes"
1514
1615 "github.com/ydb-platform/ydb-go-sdk/v3"
17- "github.com/ydb-platform/ydb-go-sdk/v3/balancers"
1816 "github.com/ydb-platform/ydb-go-sdk/v3/trace"
1917)
2018
21- func ExampleOpen () {
22- ctx := context .TODO ()
23- db , err := ydb .Open (ctx , "grpc://localhost:2135/local" )
24- if err != nil {
25- fmt .Printf ("connection failed: %v" , err )
26- }
27- defer db .Close (ctx ) // cleanup resources
28- fmt .Printf ("connected to %s, database '%s'" , db .Endpoint (), db .Name ())
29- }
30-
31- func ExampleOpen_advanced () {
32- ctx := context .TODO ()
33- db , err := ydb .Open (
34- ctx ,
35- "grpc://localhost:2135/local" ,
36- ydb .WithAnonymousCredentials (),
37- ydb .WithBalancer (
38- balancers .PreferLocationsWithFallback (
39- balancers .RandomChoice (), "a" , "b" ,
40- ),
41- ),
42- ydb .WithSessionPoolSizeLimit (100 ),
43- )
44- if err != nil {
45- fmt .Printf ("connection failed: %v" , err )
46- }
47- defer db .Close (ctx ) // cleanup resources
48- fmt .Printf ("connected to %s, database '%s'" , db .Endpoint (), db .Name ())
49- }
50-
5119func TestZeroDialTimeout (t * testing.T ) {
5220 ctx , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
5321 defer cancel ()
0 commit comments