44 "context"
55 "crypto/x509"
66 "encoding/pem"
7- "fmt"
87 "io/ioutil"
98 "os"
109 "path/filepath"
@@ -69,6 +68,8 @@ func WithRequestsType(requestsType string) Option {
6968}
7069
7170// WithConnectionString accept connection string like 'grpc[s]://{endpoint}/?database={database}'
71+ // Warning: WithConnectionString will be removed at next major release
72+ // (connection string will be required string param of ydb.New)
7273func WithConnectionString (connectionString string ) Option {
7374 return func (ctx context.Context , c * connection ) error {
7475 var (
@@ -96,14 +97,6 @@ func WithConnectionString(connectionString string) Option {
9697 }
9798}
9899
99- func RegisterParser (param string , parser func (value string ) ([]config.Option , error )) (err error ) {
100- err = dsn .Register (param , parser )
101- if err != nil {
102- return xerrors .WithStackTrace (fmt .Errorf ("%w: %s" , err , param ))
103- }
104- return nil
105- }
106-
107100// WithConnectionTTL defines duration for parking idle connections
108101// Warning: if defined WithSessionPoolIdleThreshold - idleThreshold must be less than connectionTTL
109102func WithConnectionTTL (ttl time.Duration ) Option {
@@ -113,27 +106,35 @@ func WithConnectionTTL(ttl time.Duration) Option {
113106 }
114107}
115108
109+ // WithEndpoint defines endpoint option
110+ // Deprecated: use WithConnectionString or dsn package instead
116111func WithEndpoint (endpoint string ) Option {
117112 return func (ctx context.Context , c * connection ) error {
118113 c .options = append (c .options , config .WithEndpoint (endpoint ))
119114 return nil
120115 }
121116}
122117
118+ // WithDatabase defines database option
119+ // Deprecated: use WithConnectionString or dsn package instead
123120func WithDatabase (database string ) Option {
124121 return func (ctx context.Context , c * connection ) error {
125122 c .options = append (c .options , config .WithDatabase (database ))
126123 return nil
127124 }
128125}
129126
127+ // WithSecure defines secure option
128+ // Deprecated: use WithConnectionString or dsn package instead
130129func WithSecure (secure bool ) Option {
131130 return func (ctx context.Context , c * connection ) error {
132131 c .options = append (c .options , config .WithSecure (secure ))
133132 return nil
134133 }
135134}
136135
136+ // WithInsecure defines secure option
137+ // Deprecated: use WithConnectionString or dsn package instead
137138func WithInsecure () Option {
138139 return func (ctx context.Context , c * connection ) error {
139140 c .options = append (c .options , config .WithSecure (false ))
0 commit comments