@@ -8,14 +8,14 @@ import (
88
99 "github.com/ydb-platform/ydb-go-sdk/v3/config"
1010 "github.com/ydb-platform/ydb-go-sdk/v3/internal/bind"
11- "github.com/ydb-platform/ydb-go-sdk/v3/internal/connector "
12- querySql "github.com/ydb-platform/ydb-go-sdk/v3/internal/query/conn "
13- tableSql "github.com/ydb-platform/ydb-go-sdk/v3/internal/table/conn "
11+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql "
12+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql/legacy "
13+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql/propose "
1414)
1515
1616func TestParse (t * testing.T ) {
17- newConnector := func (opts ... connector .Option ) * connector .Connector {
18- c := & connector .Connector {}
17+ newConnector := func (opts ... xsql .Option ) * xsql .Connector {
18+ c := & xsql .Connector {}
1919 for _ , opt := range opts {
2020 if opt != nil {
2121 if err := opt .Apply (c ); err != nil {
@@ -26,11 +26,11 @@ func TestParse(t *testing.T) {
2626
2727 return c
2828 }
29- newTableConn := func (opts ... tableSql .Option ) * tableSql .Conn {
30- return tableSql .New (context .Background (), nil , nil , opts ... )
29+ newLegacyConn := func (opts ... legacy .Option ) * legacy .Conn {
30+ return legacy .New (context .Background (), nil , nil , opts ... )
3131 }
32- newQueryConn := func (opts ... querySql .Option ) * querySql .Conn {
33- return querySql .New (context .Background (), nil , nil , opts ... )
32+ newQueryConn := func (opts ... propose .Option ) * propose .Conn {
33+ return propose .New (context .Background (), nil , nil , opts ... )
3434 }
3535 compareConfigs := func (t * testing.T , lhs , rhs * config.Config ) {
3636 require .Equal (t , lhs .Secure (), rhs .Secure ())
@@ -40,7 +40,7 @@ func TestParse(t *testing.T) {
4040 for _ , tt := range []struct {
4141 dsn string
4242 opts []config.Option
43- connectorOpts []connector .Option
43+ connectorOpts []xsql .Option
4444 err error
4545 }{
4646 {
@@ -70,8 +70,8 @@ func TestParse(t *testing.T) {
7070 config .WithEndpoint ("localhost:2135" ),
7171 config .WithDatabase ("/local" ),
7272 },
73- connectorOpts : []connector .Option {
74- connector .WithDefaultQueryMode (tableSql .ScriptingQueryMode ),
73+ connectorOpts : []xsql .Option {
74+ xsql .WithDefaultQueryMode (legacy .ScriptingQueryMode ),
7575 },
7676 err : nil ,
7777 },
@@ -82,9 +82,9 @@ func TestParse(t *testing.T) {
8282 config .WithEndpoint ("localhost:2135" ),
8383 config .WithDatabase ("/local" ),
8484 },
85- connectorOpts : []connector .Option {
86- connector .WithDefaultQueryMode (tableSql .ScriptingQueryMode ),
87- connector .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
85+ connectorOpts : []xsql .Option {
86+ xsql .WithDefaultQueryMode (legacy .ScriptingQueryMode ),
87+ xsql .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
8888 },
8989 err : nil ,
9090 },
@@ -95,10 +95,10 @@ func TestParse(t *testing.T) {
9595 config .WithEndpoint ("localhost:2135" ),
9696 config .WithDatabase ("/local" ),
9797 },
98- connectorOpts : []connector .Option {
99- connector .WithDefaultQueryMode (tableSql .ScriptingQueryMode ),
100- connector .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
101- connector .WithQueryBind (bind.NumericArgs {}),
98+ connectorOpts : []xsql .Option {
99+ xsql .WithDefaultQueryMode (legacy .ScriptingQueryMode ),
100+ xsql .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
101+ xsql .WithQueryBind (bind.NumericArgs {}),
102102 },
103103 err : nil ,
104104 },
@@ -109,10 +109,10 @@ func TestParse(t *testing.T) {
109109 config .WithEndpoint ("localhost:2135" ),
110110 config .WithDatabase ("/local" ),
111111 },
112- connectorOpts : []connector .Option {
113- connector .WithDefaultQueryMode (tableSql .ScriptingQueryMode ),
114- connector .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
115- connector .WithQueryBind (bind.PositionalArgs {}),
112+ connectorOpts : []xsql .Option {
113+ xsql .WithDefaultQueryMode (legacy .ScriptingQueryMode ),
114+ xsql .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
115+ xsql .WithQueryBind (bind.PositionalArgs {}),
116116 },
117117 err : nil ,
118118 },
@@ -123,10 +123,10 @@ func TestParse(t *testing.T) {
123123 config .WithEndpoint ("localhost:2135" ),
124124 config .WithDatabase ("/local" ),
125125 },
126- connectorOpts : []connector .Option {
127- connector .WithDefaultQueryMode (tableSql .ScriptingQueryMode ),
128- connector .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
129- connector .WithQueryBind (bind.AutoDeclare {}),
126+ connectorOpts : []xsql .Option {
127+ xsql .WithDefaultQueryMode (legacy .ScriptingQueryMode ),
128+ xsql .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
129+ xsql .WithQueryBind (bind.AutoDeclare {}),
130130 },
131131 err : nil ,
132132 },
@@ -137,9 +137,9 @@ func TestParse(t *testing.T) {
137137 config .WithEndpoint ("localhost:2135" ),
138138 config .WithDatabase ("/local" ),
139139 },
140- connectorOpts : []connector .Option {
141- connector .WithDefaultQueryMode (tableSql .ScriptingQueryMode ),
142- connector .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
140+ connectorOpts : []xsql .Option {
141+ xsql .WithDefaultQueryMode (legacy .ScriptingQueryMode ),
142+ xsql .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
143143 },
144144 err : nil ,
145145 },
@@ -150,11 +150,11 @@ func TestParse(t *testing.T) {
150150 config .WithEndpoint ("localhost:2135" ),
151151 config .WithDatabase ("/local" ),
152152 },
153- connectorOpts : []connector .Option {
154- connector .WithDefaultQueryMode (tableSql .ScriptingQueryMode ),
155- connector .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
156- connector .WithQueryBind (bind.PositionalArgs {}),
157- connector .WithQueryBind (bind.AutoDeclare {}),
153+ connectorOpts : []xsql .Option {
154+ xsql .WithDefaultQueryMode (legacy .ScriptingQueryMode ),
155+ xsql .WithQueryBind (bind .TablePathPrefix ("path/to/tables" )),
156+ xsql .WithQueryBind (bind.PositionalArgs {}),
157+ xsql .WithQueryBind (bind.AutoDeclare {}),
158158 },
159159 err : nil ,
160160 },
@@ -165,9 +165,9 @@ func TestParse(t *testing.T) {
165165 config .WithEndpoint ("localhost:2135" ),
166166 config .WithDatabase ("/local" ),
167167 },
168- connectorOpts : []connector .Option {
169- connector . WithFakeTx (tableSql . ScriptingQueryMode ),
170- connector . WithFakeTx (tableSql . SchemeQueryMode ),
168+ connectorOpts : []xsql .Option {
169+ WithFakeTx (ScriptingQueryMode ),
170+ WithFakeTx (SchemeQueryMode ),
171171 },
172172 err : nil ,
173173 },
@@ -183,15 +183,15 @@ func TestParse(t *testing.T) {
183183 exp := newConnector (tt .connectorOpts ... )
184184 act := newConnector (d .databaseSQLOptions ... )
185185 t .Run ("tableOptions" , func (t * testing.T ) {
186- require .Equal (t , newTableConn (exp .TableOpts ... ), newTableConn (act .TableOpts ... ))
186+ require .Equal (t , newLegacyConn (exp .LegacyOpts ... ), newLegacyConn (act .LegacyOpts ... ))
187187 })
188188 t .Run ("queryOptions" , func (t * testing.T ) {
189- require .Equal (t , newQueryConn (exp .QueryOpts ... ), newQueryConn (act .QueryOpts ... ))
189+ require .Equal (t , newQueryConn (exp .Options ... ), newQueryConn (act .Options ... ))
190190 })
191- exp .TableOpts = nil
192- exp .QueryOpts = nil
193- act .TableOpts = nil
194- act .QueryOpts = nil
191+ exp .LegacyOpts = nil
192+ exp .Options = nil
193+ act .LegacyOpts = nil
194+ act .Options = nil
195195 require .Equal (t , exp .Bindings (), act .Bindings ())
196196 require .Equal (t , exp , act )
197197 compareConfigs (t , config .New (tt .opts ... ), d .config )
0 commit comments