@@ -16,9 +16,9 @@ import (
1616
1717 "github.com/ydb-platform/ydb-go-sdk/v3/internal/allocator"
1818 "github.com/ydb-platform/ydb-go-sdk/v3/internal/params"
19+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/query/options"
1920 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
2021 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xtest"
21- "github.com/ydb-platform/ydb-go-sdk/v3/query"
2222)
2323
2424func TestExecute (t * testing.T ) {
@@ -356,7 +356,7 @@ func TestExecute(t *testing.T) {
356356 service := NewMockQueryServiceClient (ctrl )
357357 service .EXPECT ().ExecuteQuery (gomock .Any (), gomock .Any ()).Return (stream , nil )
358358 t .Log ("execute" )
359- tx , r , err := execute (ctx , & Session {id : "123" }, service , "" , query .ExecuteSettings ())
359+ tx , r , err := execute (ctx , & Session {id : "123" }, service , "" , options .ExecuteSettings ())
360360 require .NoError (t , err )
361361 defer r .Close (ctx )
362362 require .EqualValues (t , "456" , tx .id )
@@ -469,7 +469,7 @@ func TestExecute(t *testing.T) {
469469 service := NewMockQueryServiceClient (ctrl )
470470 service .EXPECT ().ExecuteQuery (gomock .Any (), gomock .Any ()).Return (nil , grpcStatus .Error (grpcCodes .Unavailable , "" ))
471471 t .Log ("execute" )
472- _ , _ , err := execute (ctx , & Session {id : "123" }, service , "" , query .ExecuteSettings ())
472+ _ , _ , err := execute (ctx , & Session {id : "123" }, service , "" , options .ExecuteSettings ())
473473 require .Error (t , err )
474474 require .True (t , xerrors .IsTransportError (err , grpcCodes .Unavailable ))
475475 })
@@ -573,7 +573,7 @@ func TestExecute(t *testing.T) {
573573 service := NewMockQueryServiceClient (ctrl )
574574 service .EXPECT ().ExecuteQuery (gomock .Any (), gomock .Any ()).Return (stream , nil )
575575 t .Log ("execute" )
576- tx , r , err := execute (ctx , & Session {id : "123" }, service , "" , query .ExecuteSettings ())
576+ tx , r , err := execute (ctx , & Session {id : "123" }, service , "" , options .ExecuteSettings ())
577577 require .NoError (t , err )
578578 defer r .Close (ctx )
579579 require .EqualValues (t , "456" , tx .id )
@@ -637,7 +637,7 @@ func TestExecute(t *testing.T) {
637637 service := NewMockQueryServiceClient (ctrl )
638638 service .EXPECT ().ExecuteQuery (gomock .Any (), gomock .Any ()).Return (stream , nil )
639639 t .Log ("execute" )
640- _ , _ , err := execute (ctx , & Session {id : "123" }, service , "" , query .ExecuteSettings ())
640+ _ , _ , err := execute (ctx , & Session {id : "123" }, service , "" , options .ExecuteSettings ())
641641 require .Error (t , err )
642642 require .True (t , xerrors .IsOperationError (err , Ydb .StatusIds_UNAVAILABLE ))
643643 })
@@ -713,7 +713,7 @@ func TestExecute(t *testing.T) {
713713 service := NewMockQueryServiceClient (ctrl )
714714 service .EXPECT ().ExecuteQuery (gomock .Any (), gomock .Any ()).Return (stream , nil )
715715 t .Log ("execute" )
716- tx , r , err := execute (ctx , & Session {id : "123" }, service , "" , query .ExecuteSettings ())
716+ tx , r , err := execute (ctx , & Session {id : "123" }, service , "" , options .ExecuteSettings ())
717717 require .NoError (t , err )
718718 defer r .Close (ctx )
719719 require .EqualValues (t , "456" , tx .id )
@@ -760,7 +760,7 @@ func TestExecuteQueryRequest(t *testing.T) {
760760 a := allocator .New ()
761761 for _ , tt := range []struct {
762762 name string
763- opts []query .ExecuteOption
763+ opts []options .ExecuteOption
764764 request * Ydb_Query.ExecuteQueryRequest
765765 callOptions []grpc.CallOption
766766 }{
@@ -791,8 +791,8 @@ func TestExecuteQueryRequest(t *testing.T) {
791791 },
792792 {
793793 name : "WithParams" ,
794- opts : []query .ExecuteOption {
795- query .WithParameters (
794+ opts : []options .ExecuteOption {
795+ options .WithParameters (
796796 params.Builder {}.
797797 Param ("$a" ).Text ("A" ).
798798 Param ("$b" ).Text ("B" ).
@@ -863,8 +863,8 @@ func TestExecuteQueryRequest(t *testing.T) {
863863 },
864864 {
865865 name : "WithExplain" ,
866- opts : []query .ExecuteOption {
867- query .WithExecMode (query .ExecModeExplain ),
866+ opts : []options .ExecuteOption {
867+ options .WithExecMode (options .ExecModeExplain ),
868868 },
869869 request : & Ydb_Query.ExecuteQueryRequest {
870870 SessionId : "WithExplain" ,
@@ -891,8 +891,8 @@ func TestExecuteQueryRequest(t *testing.T) {
891891 },
892892 {
893893 name : "WithValidate" ,
894- opts : []query .ExecuteOption {
895- query .WithExecMode (query .ExecModeValidate ),
894+ opts : []options .ExecuteOption {
895+ options .WithExecMode (options .ExecModeValidate ),
896896 },
897897 request : & Ydb_Query.ExecuteQueryRequest {
898898 SessionId : "WithValidate" ,
@@ -919,8 +919,8 @@ func TestExecuteQueryRequest(t *testing.T) {
919919 },
920920 {
921921 name : "WithValidate" ,
922- opts : []query .ExecuteOption {
923- query .WithExecMode (query .ExecModeParse ),
922+ opts : []options .ExecuteOption {
923+ options .WithExecMode (options .ExecModeParse ),
924924 },
925925 request : & Ydb_Query.ExecuteQueryRequest {
926926 SessionId : "WithValidate" ,
@@ -947,8 +947,8 @@ func TestExecuteQueryRequest(t *testing.T) {
947947 },
948948 {
949949 name : "WithStatsFull" ,
950- opts : []query .ExecuteOption {
951- query .WithStatsMode (query .StatsModeFull ),
950+ opts : []options .ExecuteOption {
951+ options .WithStatsMode (options .StatsModeFull ),
952952 },
953953 request : & Ydb_Query.ExecuteQueryRequest {
954954 SessionId : "WithStatsFull" ,
@@ -975,8 +975,8 @@ func TestExecuteQueryRequest(t *testing.T) {
975975 },
976976 {
977977 name : "WithStatsBasic" ,
978- opts : []query .ExecuteOption {
979- query .WithStatsMode (query .StatsModeBasic ),
978+ opts : []options .ExecuteOption {
979+ options .WithStatsMode (options .StatsModeBasic ),
980980 },
981981 request : & Ydb_Query.ExecuteQueryRequest {
982982 SessionId : "WithStatsBasic" ,
@@ -1003,8 +1003,8 @@ func TestExecuteQueryRequest(t *testing.T) {
10031003 },
10041004 {
10051005 name : "WithStatsProfile" ,
1006- opts : []query .ExecuteOption {
1007- query .WithStatsMode (query .StatsModeProfile ),
1006+ opts : []options .ExecuteOption {
1007+ options .WithStatsMode (options .StatsModeProfile ),
10081008 },
10091009 request : & Ydb_Query.ExecuteQueryRequest {
10101010 SessionId : "WithStatsProfile" ,
@@ -1031,8 +1031,8 @@ func TestExecuteQueryRequest(t *testing.T) {
10311031 },
10321032 {
10331033 name : "WithGrpcCallOptions" ,
1034- opts : []query .ExecuteOption {
1035- query .WithCallOptions (grpc .Header (& metadata.MD {
1034+ opts : []options .ExecuteOption {
1035+ options .WithCallOptions (grpc .Header (& metadata.MD {
10361036 "ext-header" : []string {"test" },
10371037 })),
10381038 },
@@ -1066,7 +1066,7 @@ func TestExecuteQueryRequest(t *testing.T) {
10661066 },
10671067 } {
10681068 t .Run (tt .name , func (t * testing.T ) {
1069- request , callOptions := executeQueryRequest (a , tt .name , tt .name , query .ExecuteSettings (tt .opts ... ))
1069+ request , callOptions := executeQueryRequest (a , tt .name , tt .name , options .ExecuteSettings (tt .opts ... ))
10701070 require .Equal (t , request .String (), tt .request .String ())
10711071 require .Equal (t , tt .callOptions , callOptions )
10721072 })
0 commit comments