github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/params/set_test.go (about)

     1  package params
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	"github.com/stretchr/testify/require"
     8  	"github.com/ydb-platform/ydb-go-genproto/protos/Ydb"
     9  
    10  	"github.com/ydb-platform/ydb-go-sdk/v3/internal/allocator"
    11  	"github.com/ydb-platform/ydb-go-sdk/v3/internal/value"
    12  	"github.com/ydb-platform/ydb-go-sdk/v3/internal/xtest"
    13  )
    14  
    15  func TestSet(t *testing.T) {
    16  	for _, tt := range []struct {
    17  		name    string
    18  		builder Builder
    19  		params  map[string]*Ydb.TypedValue
    20  	}{
    21  		{
    22  			name:    xtest.CurrentFileLine(),
    23  			builder: Builder{}.Param("$x").Set().AddItem().Uint64(123).Build(),
    24  			params: map[string]*Ydb.TypedValue{
    25  				"$x": {
    26  					Type: &Ydb.Type{
    27  						Type: &Ydb.Type_DictType{
    28  							DictType: &Ydb.DictType{
    29  								Key: &Ydb.Type{
    30  									Type: &Ydb.Type_TypeId{
    31  										TypeId: Ydb.Type_UINT64,
    32  									},
    33  								},
    34  								Payload: &Ydb.Type{
    35  									Type: &Ydb.Type_VoidType{},
    36  								},
    37  							},
    38  						},
    39  					},
    40  					Value: &Ydb.Value{
    41  						Pairs: []*Ydb.ValuePair{
    42  							{
    43  								Key: &Ydb.Value{
    44  									Value: &Ydb.Value_Uint64Value{
    45  										Uint64Value: 123,
    46  									},
    47  								},
    48  								Payload: &Ydb.Value{
    49  									Value: &Ydb.Value_NullFlagValue{},
    50  								},
    51  							},
    52  						},
    53  					},
    54  				},
    55  			},
    56  		},
    57  		{
    58  			name:    xtest.CurrentFileLine(),
    59  			builder: Builder{}.Param("$x").Set().AddItem().Int64(123).Build(),
    60  			params: map[string]*Ydb.TypedValue{
    61  				"$x": {
    62  					Type: &Ydb.Type{
    63  						Type: &Ydb.Type_DictType{
    64  							DictType: &Ydb.DictType{
    65  								Key: &Ydb.Type{
    66  									Type: &Ydb.Type_TypeId{
    67  										TypeId: Ydb.Type_INT64,
    68  									},
    69  								},
    70  								Payload: &Ydb.Type{
    71  									Type: &Ydb.Type_VoidType{},
    72  								},
    73  							},
    74  						},
    75  					},
    76  					Value: &Ydb.Value{
    77  						Pairs: []*Ydb.ValuePair{
    78  							{
    79  								Key: &Ydb.Value{
    80  									Value: &Ydb.Value_Int64Value{
    81  										Int64Value: 123,
    82  									},
    83  								},
    84  								Payload: &Ydb.Value{
    85  									Value: &Ydb.Value_NullFlagValue{},
    86  								},
    87  							},
    88  						},
    89  					},
    90  				},
    91  			},
    92  		},
    93  		{
    94  			name:    xtest.CurrentFileLine(),
    95  			builder: Builder{}.Param("$x").Set().AddItem().Uint32(123).Build(),
    96  			params: map[string]*Ydb.TypedValue{
    97  				"$x": {
    98  					Type: &Ydb.Type{
    99  						Type: &Ydb.Type_DictType{
   100  							DictType: &Ydb.DictType{
   101  								Key: &Ydb.Type{
   102  									Type: &Ydb.Type_TypeId{
   103  										TypeId: Ydb.Type_UINT32,
   104  									},
   105  								},
   106  								Payload: &Ydb.Type{
   107  									Type: &Ydb.Type_VoidType{},
   108  								},
   109  							},
   110  						},
   111  					},
   112  					Value: &Ydb.Value{
   113  						Pairs: []*Ydb.ValuePair{
   114  							{
   115  								Key: &Ydb.Value{
   116  									Value: &Ydb.Value_Uint32Value{
   117  										Uint32Value: 123,
   118  									},
   119  								},
   120  								Payload: &Ydb.Value{
   121  									Value: &Ydb.Value_NullFlagValue{},
   122  								},
   123  							},
   124  						},
   125  					},
   126  				},
   127  			},
   128  		},
   129  		{
   130  			name:    xtest.CurrentFileLine(),
   131  			builder: Builder{}.Param("$x").Set().AddItem().Int32(123).Build(),
   132  			params: map[string]*Ydb.TypedValue{
   133  				"$x": {
   134  					Type: &Ydb.Type{
   135  						Type: &Ydb.Type_DictType{
   136  							DictType: &Ydb.DictType{
   137  								Key: &Ydb.Type{
   138  									Type: &Ydb.Type_TypeId{
   139  										TypeId: Ydb.Type_INT32,
   140  									},
   141  								},
   142  								Payload: &Ydb.Type{
   143  									Type: &Ydb.Type_VoidType{},
   144  								},
   145  							},
   146  						},
   147  					},
   148  					Value: &Ydb.Value{
   149  						Pairs: []*Ydb.ValuePair{
   150  							{
   151  								Key: &Ydb.Value{
   152  									Value: &Ydb.Value_Int32Value{
   153  										Int32Value: 123,
   154  									},
   155  								},
   156  								Payload: &Ydb.Value{
   157  									Value: &Ydb.Value_NullFlagValue{},
   158  								},
   159  							},
   160  						},
   161  					},
   162  				},
   163  			},
   164  		},
   165  		{
   166  			name:    xtest.CurrentFileLine(),
   167  			builder: Builder{}.Param("$x").Set().AddItem().Uint16(123).Build(),
   168  			params: map[string]*Ydb.TypedValue{
   169  				"$x": {
   170  					Type: &Ydb.Type{
   171  						Type: &Ydb.Type_DictType{
   172  							DictType: &Ydb.DictType{
   173  								Key: &Ydb.Type{
   174  									Type: &Ydb.Type_TypeId{
   175  										TypeId: Ydb.Type_UINT16,
   176  									},
   177  								},
   178  								Payload: &Ydb.Type{
   179  									Type: &Ydb.Type_VoidType{},
   180  								},
   181  							},
   182  						},
   183  					},
   184  					Value: &Ydb.Value{
   185  						Pairs: []*Ydb.ValuePair{
   186  							{
   187  								Key: &Ydb.Value{
   188  									Value: &Ydb.Value_Uint32Value{
   189  										Uint32Value: 123,
   190  									},
   191  								},
   192  								Payload: &Ydb.Value{
   193  									Value: &Ydb.Value_NullFlagValue{},
   194  								},
   195  							},
   196  						},
   197  					},
   198  				},
   199  			},
   200  		},
   201  		{
   202  			name:    xtest.CurrentFileLine(),
   203  			builder: Builder{}.Param("$x").Set().AddItem().Int16(123).Build(),
   204  			params: map[string]*Ydb.TypedValue{
   205  				"$x": {
   206  					Type: &Ydb.Type{
   207  						Type: &Ydb.Type_DictType{
   208  							DictType: &Ydb.DictType{
   209  								Key: &Ydb.Type{
   210  									Type: &Ydb.Type_TypeId{
   211  										TypeId: Ydb.Type_INT16,
   212  									},
   213  								},
   214  								Payload: &Ydb.Type{
   215  									Type: &Ydb.Type_VoidType{},
   216  								},
   217  							},
   218  						},
   219  					},
   220  					Value: &Ydb.Value{
   221  						Pairs: []*Ydb.ValuePair{
   222  							{
   223  								Key: &Ydb.Value{
   224  									Value: &Ydb.Value_Int32Value{
   225  										Int32Value: 123,
   226  									},
   227  								},
   228  								Payload: &Ydb.Value{
   229  									Value: &Ydb.Value_NullFlagValue{},
   230  								},
   231  							},
   232  						},
   233  					},
   234  				},
   235  			},
   236  		},
   237  		{
   238  			name:    xtest.CurrentFileLine(),
   239  			builder: Builder{}.Param("$x").Set().AddItem().Uint8(123).Build(),
   240  			params: map[string]*Ydb.TypedValue{
   241  				"$x": {
   242  					Type: &Ydb.Type{
   243  						Type: &Ydb.Type_DictType{
   244  							DictType: &Ydb.DictType{
   245  								Key: &Ydb.Type{
   246  									Type: &Ydb.Type_TypeId{
   247  										TypeId: Ydb.Type_UINT8,
   248  									},
   249  								},
   250  								Payload: &Ydb.Type{
   251  									Type: &Ydb.Type_VoidType{},
   252  								},
   253  							},
   254  						},
   255  					},
   256  					Value: &Ydb.Value{
   257  						Pairs: []*Ydb.ValuePair{
   258  							{
   259  								Key: &Ydb.Value{
   260  									Value: &Ydb.Value_Uint32Value{
   261  										Uint32Value: 123,
   262  									},
   263  								},
   264  								Payload: &Ydb.Value{
   265  									Value: &Ydb.Value_NullFlagValue{},
   266  								},
   267  							},
   268  						},
   269  					},
   270  				},
   271  			},
   272  		},
   273  		{
   274  			name:    xtest.CurrentFileLine(),
   275  			builder: Builder{}.Param("$x").Set().AddItem().Int8(123).Build(),
   276  			params: map[string]*Ydb.TypedValue{
   277  				"$x": {
   278  					Type: &Ydb.Type{
   279  						Type: &Ydb.Type_DictType{
   280  							DictType: &Ydb.DictType{
   281  								Key: &Ydb.Type{
   282  									Type: &Ydb.Type_TypeId{
   283  										TypeId: Ydb.Type_INT8,
   284  									},
   285  								},
   286  								Payload: &Ydb.Type{
   287  									Type: &Ydb.Type_VoidType{},
   288  								},
   289  							},
   290  						},
   291  					},
   292  					Value: &Ydb.Value{
   293  						Pairs: []*Ydb.ValuePair{
   294  							{
   295  								Key: &Ydb.Value{
   296  									Value: &Ydb.Value_Int32Value{
   297  										Int32Value: 123,
   298  									},
   299  								},
   300  								Payload: &Ydb.Value{
   301  									Value: &Ydb.Value_NullFlagValue{},
   302  								},
   303  							},
   304  						},
   305  					},
   306  				},
   307  			},
   308  		},
   309  		{
   310  			name:    xtest.CurrentFileLine(),
   311  			builder: Builder{}.Param("$x").Set().AddItem().Bool(true).Build(),
   312  			params: map[string]*Ydb.TypedValue{
   313  				"$x": {
   314  					Type: &Ydb.Type{
   315  						Type: &Ydb.Type_DictType{
   316  							DictType: &Ydb.DictType{
   317  								Key: &Ydb.Type{
   318  									Type: &Ydb.Type_TypeId{
   319  										TypeId: Ydb.Type_BOOL,
   320  									},
   321  								},
   322  								Payload: &Ydb.Type{
   323  									Type: &Ydb.Type_VoidType{},
   324  								},
   325  							},
   326  						},
   327  					},
   328  					Value: &Ydb.Value{
   329  						Pairs: []*Ydb.ValuePair{
   330  							{
   331  								Key: &Ydb.Value{
   332  									Value: &Ydb.Value_BoolValue{
   333  										BoolValue: true,
   334  									},
   335  								},
   336  								Payload: &Ydb.Value{
   337  									Value: &Ydb.Value_NullFlagValue{},
   338  								},
   339  							},
   340  						},
   341  					},
   342  				},
   343  			},
   344  		},
   345  		{
   346  			name:    xtest.CurrentFileLine(),
   347  			builder: Builder{}.Param("$x").Set().AddItem().Text("test").Build(),
   348  			params: map[string]*Ydb.TypedValue{
   349  				"$x": {
   350  					Type: &Ydb.Type{
   351  						Type: &Ydb.Type_DictType{
   352  							DictType: &Ydb.DictType{
   353  								Key: &Ydb.Type{
   354  									Type: &Ydb.Type_TypeId{
   355  										TypeId: Ydb.Type_UTF8,
   356  									},
   357  								},
   358  								Payload: &Ydb.Type{
   359  									Type: &Ydb.Type_VoidType{},
   360  								},
   361  							},
   362  						},
   363  					},
   364  					Value: &Ydb.Value{
   365  						Pairs: []*Ydb.ValuePair{
   366  							{
   367  								Key: &Ydb.Value{
   368  									Value: &Ydb.Value_TextValue{
   369  										TextValue: "test",
   370  									},
   371  								},
   372  								Payload: &Ydb.Value{
   373  									Value: &Ydb.Value_NullFlagValue{},
   374  								},
   375  							},
   376  						},
   377  					},
   378  				},
   379  			},
   380  		},
   381  		{
   382  			name:    xtest.CurrentFileLine(),
   383  			builder: Builder{}.Param("$x").Set().AddItem().Bytes([]byte("test")).Build(),
   384  			params: map[string]*Ydb.TypedValue{
   385  				"$x": {
   386  					Type: &Ydb.Type{
   387  						Type: &Ydb.Type_DictType{
   388  							DictType: &Ydb.DictType{
   389  								Key: &Ydb.Type{
   390  									Type: &Ydb.Type_TypeId{
   391  										TypeId: Ydb.Type_STRING,
   392  									},
   393  								},
   394  								Payload: &Ydb.Type{
   395  									Type: &Ydb.Type_VoidType{},
   396  								},
   397  							},
   398  						},
   399  					},
   400  					Value: &Ydb.Value{
   401  						Pairs: []*Ydb.ValuePair{
   402  							{
   403  								Key: &Ydb.Value{
   404  									Value: &Ydb.Value_BytesValue{
   405  										BytesValue: []byte("test"),
   406  									},
   407  								},
   408  								Payload: &Ydb.Value{
   409  									Value: &Ydb.Value_NullFlagValue{},
   410  								},
   411  							},
   412  						},
   413  					},
   414  				},
   415  			},
   416  		},
   417  		{
   418  			name:    xtest.CurrentFileLine(),
   419  			builder: Builder{}.Param("$x").Set().AddItem().Float(123).Build(),
   420  			params: map[string]*Ydb.TypedValue{
   421  				"$x": {
   422  					Type: &Ydb.Type{
   423  						Type: &Ydb.Type_DictType{
   424  							DictType: &Ydb.DictType{
   425  								Key: &Ydb.Type{
   426  									Type: &Ydb.Type_TypeId{
   427  										TypeId: Ydb.Type_FLOAT,
   428  									},
   429  								},
   430  								Payload: &Ydb.Type{
   431  									Type: &Ydb.Type_VoidType{},
   432  								},
   433  							},
   434  						},
   435  					},
   436  					Value: &Ydb.Value{
   437  						Pairs: []*Ydb.ValuePair{
   438  							{
   439  								Key: &Ydb.Value{
   440  									Value: &Ydb.Value_FloatValue{
   441  										FloatValue: 123,
   442  									},
   443  								},
   444  								Payload: &Ydb.Value{
   445  									Value: &Ydb.Value_NullFlagValue{},
   446  								},
   447  							},
   448  						},
   449  					},
   450  				},
   451  			},
   452  		},
   453  		{
   454  			name:    xtest.CurrentFileLine(),
   455  			builder: Builder{}.Param("$x").Set().AddItem().Double(123).Build(),
   456  			params: map[string]*Ydb.TypedValue{
   457  				"$x": {
   458  					Type: &Ydb.Type{
   459  						Type: &Ydb.Type_DictType{
   460  							DictType: &Ydb.DictType{
   461  								Key: &Ydb.Type{
   462  									Type: &Ydb.Type_TypeId{
   463  										TypeId: Ydb.Type_DOUBLE,
   464  									},
   465  								},
   466  								Payload: &Ydb.Type{
   467  									Type: &Ydb.Type_VoidType{},
   468  								},
   469  							},
   470  						},
   471  					},
   472  					Value: &Ydb.Value{
   473  						Pairs: []*Ydb.ValuePair{
   474  							{
   475  								Key: &Ydb.Value{
   476  									Value: &Ydb.Value_DoubleValue{
   477  										DoubleValue: 123,
   478  									},
   479  								},
   480  								Payload: &Ydb.Value{
   481  									Value: &Ydb.Value_NullFlagValue{},
   482  								},
   483  							},
   484  						},
   485  					},
   486  				},
   487  			},
   488  		},
   489  		{
   490  			name:    xtest.CurrentFileLine(),
   491  			builder: Builder{}.Param("$x").Set().AddItem().Interval(time.Second).Build(),
   492  			params: map[string]*Ydb.TypedValue{
   493  				"$x": {
   494  					Type: &Ydb.Type{
   495  						Type: &Ydb.Type_DictType{
   496  							DictType: &Ydb.DictType{
   497  								Key: &Ydb.Type{
   498  									Type: &Ydb.Type_TypeId{
   499  										TypeId: Ydb.Type_INTERVAL,
   500  									},
   501  								},
   502  								Payload: &Ydb.Type{
   503  									Type: &Ydb.Type_VoidType{},
   504  								},
   505  							},
   506  						},
   507  					},
   508  					Value: &Ydb.Value{
   509  						Pairs: []*Ydb.ValuePair{
   510  							{
   511  								Key: &Ydb.Value{
   512  									Value: &Ydb.Value_Int64Value{
   513  										Int64Value: 1000000,
   514  									},
   515  								},
   516  								Payload: &Ydb.Value{
   517  									Value: &Ydb.Value_NullFlagValue{},
   518  								},
   519  							},
   520  						},
   521  					},
   522  				},
   523  			},
   524  		},
   525  		{
   526  			name:    xtest.CurrentFileLine(),
   527  			builder: Builder{}.Param("$x").Set().AddItem().Datetime(time.Unix(123456789, 456)).Build(),
   528  			params: map[string]*Ydb.TypedValue{
   529  				"$x": {
   530  					Type: &Ydb.Type{
   531  						Type: &Ydb.Type_DictType{
   532  							DictType: &Ydb.DictType{
   533  								Key: &Ydb.Type{
   534  									Type: &Ydb.Type_TypeId{
   535  										TypeId: Ydb.Type_DATETIME,
   536  									},
   537  								},
   538  								Payload: &Ydb.Type{
   539  									Type: &Ydb.Type_VoidType{},
   540  								},
   541  							},
   542  						},
   543  					},
   544  					Value: &Ydb.Value{
   545  						Pairs: []*Ydb.ValuePair{
   546  							{
   547  								Key: &Ydb.Value{
   548  									Value: &Ydb.Value_Uint32Value{
   549  										Uint32Value: 123456789,
   550  									},
   551  								},
   552  								Payload: &Ydb.Value{
   553  									Value: &Ydb.Value_NullFlagValue{},
   554  								},
   555  							},
   556  						},
   557  					},
   558  				},
   559  			},
   560  		},
   561  		{
   562  			name:    xtest.CurrentFileLine(),
   563  			builder: Builder{}.Param("$x").Set().AddItem().Date(time.Unix(123456789, 456)).Build(),
   564  			params: map[string]*Ydb.TypedValue{
   565  				"$x": {
   566  					Type: &Ydb.Type{
   567  						Type: &Ydb.Type_DictType{
   568  							DictType: &Ydb.DictType{
   569  								Key: &Ydb.Type{
   570  									Type: &Ydb.Type_TypeId{
   571  										TypeId: Ydb.Type_DATE,
   572  									},
   573  								},
   574  								Payload: &Ydb.Type{
   575  									Type: &Ydb.Type_VoidType{},
   576  								},
   577  							},
   578  						},
   579  					},
   580  					Value: &Ydb.Value{
   581  						Pairs: []*Ydb.ValuePair{
   582  							{
   583  								Key: &Ydb.Value{
   584  									Value: &Ydb.Value_Uint32Value{
   585  										Uint32Value: 1428,
   586  									},
   587  								},
   588  								Payload: &Ydb.Value{
   589  									Value: &Ydb.Value_NullFlagValue{},
   590  								},
   591  							},
   592  						},
   593  					},
   594  				},
   595  			},
   596  		},
   597  		{
   598  			name:    xtest.CurrentFileLine(),
   599  			builder: Builder{}.Param("$x").Set().AddItem().Timestamp(time.Unix(123456789, 456)).Build(),
   600  			params: map[string]*Ydb.TypedValue{
   601  				"$x": {
   602  					Type: &Ydb.Type{
   603  						Type: &Ydb.Type_DictType{
   604  							DictType: &Ydb.DictType{
   605  								Key: &Ydb.Type{
   606  									Type: &Ydb.Type_TypeId{
   607  										TypeId: Ydb.Type_TIMESTAMP,
   608  									},
   609  								},
   610  								Payload: &Ydb.Type{
   611  									Type: &Ydb.Type_VoidType{},
   612  								},
   613  							},
   614  						},
   615  					},
   616  					Value: &Ydb.Value{
   617  						Pairs: []*Ydb.ValuePair{
   618  							{
   619  								Key: &Ydb.Value{
   620  									Value: &Ydb.Value_Uint64Value{
   621  										Uint64Value: 123456789000000,
   622  									},
   623  								},
   624  								Payload: &Ydb.Value{
   625  									Value: &Ydb.Value_NullFlagValue{},
   626  								},
   627  							},
   628  						},
   629  					},
   630  				},
   631  			},
   632  		},
   633  		{
   634  			name:    xtest.CurrentFileLine(),
   635  			builder: Builder{}.Param("$x").Set().AddItem().Decimal([...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6}, 22, 9).Build(), //nolint:lll
   636  			params: map[string]*Ydb.TypedValue{
   637  				"$x": {
   638  					Type: &Ydb.Type{
   639  						Type: &Ydb.Type_DictType{
   640  							DictType: &Ydb.DictType{
   641  								Key: &Ydb.Type{
   642  									Type: &Ydb.Type_DecimalType{
   643  										DecimalType: &Ydb.DecimalType{
   644  											Precision: 22,
   645  											Scale:     9,
   646  										},
   647  									},
   648  								},
   649  								Payload: &Ydb.Type{
   650  									Type: &Ydb.Type_VoidType{},
   651  								},
   652  							},
   653  						},
   654  					},
   655  					Value: &Ydb.Value{
   656  						Pairs: []*Ydb.ValuePair{
   657  							{
   658  								Key: &Ydb.Value{
   659  									High_128: 72623859790382856,
   660  									Value: &Ydb.Value_Low_128{
   661  										Low_128: 648519454493508870,
   662  									},
   663  								},
   664  								Payload: &Ydb.Value{
   665  									Value: &Ydb.Value_NullFlagValue{},
   666  								},
   667  							},
   668  						},
   669  					},
   670  				},
   671  			},
   672  		},
   673  		{
   674  			name:    xtest.CurrentFileLine(),
   675  			builder: Builder{}.Param("$x").Set().AddItem().JSON(`{"a": 1,"b": "B"}`).Build(),
   676  			params: map[string]*Ydb.TypedValue{
   677  				"$x": {
   678  					Type: &Ydb.Type{
   679  						Type: &Ydb.Type_DictType{
   680  							DictType: &Ydb.DictType{
   681  								Key: &Ydb.Type{
   682  									Type: &Ydb.Type_TypeId{
   683  										TypeId: Ydb.Type_JSON,
   684  									},
   685  								},
   686  								Payload: &Ydb.Type{
   687  									Type: &Ydb.Type_VoidType{},
   688  								},
   689  							},
   690  						},
   691  					},
   692  					Value: &Ydb.Value{
   693  						Pairs: []*Ydb.ValuePair{
   694  							{
   695  								Key: &Ydb.Value{
   696  									Value: &Ydb.Value_TextValue{
   697  										TextValue: `{"a": 1,"b": "B"}`,
   698  									},
   699  								},
   700  								Payload: &Ydb.Value{
   701  									Value: &Ydb.Value_NullFlagValue{},
   702  								},
   703  							},
   704  						},
   705  					},
   706  				},
   707  			},
   708  		},
   709  		{
   710  			name:    xtest.CurrentFileLine(),
   711  			builder: Builder{}.Param("$x").Set().AddItem().JSONDocument(`{"a": 1,"b": "B"}`).Build(),
   712  			params: map[string]*Ydb.TypedValue{
   713  				"$x": {
   714  					Type: &Ydb.Type{
   715  						Type: &Ydb.Type_DictType{
   716  							DictType: &Ydb.DictType{
   717  								Key: &Ydb.Type{
   718  									Type: &Ydb.Type_TypeId{
   719  										TypeId: Ydb.Type_JSON_DOCUMENT,
   720  									},
   721  								},
   722  								Payload: &Ydb.Type{
   723  									Type: &Ydb.Type_VoidType{},
   724  								},
   725  							},
   726  						},
   727  					},
   728  					Value: &Ydb.Value{
   729  						Pairs: []*Ydb.ValuePair{
   730  							{
   731  								Key: &Ydb.Value{
   732  									Value: &Ydb.Value_TextValue{
   733  										TextValue: `{"a": 1,"b": "B"}`,
   734  									},
   735  								},
   736  								Payload: &Ydb.Value{
   737  									Value: &Ydb.Value_NullFlagValue{},
   738  								},
   739  							},
   740  						},
   741  					},
   742  				},
   743  			},
   744  		},
   745  		{
   746  			name:    xtest.CurrentFileLine(),
   747  			builder: Builder{}.Param("$x").Set().AddItem().YSON([]byte(`[ 1; 2; 3; 4; 5 ]`)).Build(),
   748  			params: map[string]*Ydb.TypedValue{
   749  				"$x": {
   750  					Type: &Ydb.Type{
   751  						Type: &Ydb.Type_DictType{
   752  							DictType: &Ydb.DictType{
   753  								Key: &Ydb.Type{
   754  									Type: &Ydb.Type_TypeId{
   755  										TypeId: Ydb.Type_YSON,
   756  									},
   757  								},
   758  								Payload: &Ydb.Type{
   759  									Type: &Ydb.Type_VoidType{},
   760  								},
   761  							},
   762  						},
   763  					},
   764  					Value: &Ydb.Value{
   765  						Pairs: []*Ydb.ValuePair{
   766  							{
   767  								Key: &Ydb.Value{
   768  									Value: &Ydb.Value_BytesValue{
   769  										BytesValue: []byte(`[ 1; 2; 3; 4; 5 ]`),
   770  									},
   771  								},
   772  								Payload: &Ydb.Value{
   773  									Value: &Ydb.Value_NullFlagValue{},
   774  								},
   775  							},
   776  						},
   777  					},
   778  				},
   779  			},
   780  		},
   781  		{
   782  			name: xtest.CurrentFileLine(),
   783  			builder: Builder{}.Param("$x").Set().AddItem().
   784  				UUID([...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}).
   785  				Build(),
   786  			params: map[string]*Ydb.TypedValue{
   787  				"$x": {
   788  					Type: &Ydb.Type{
   789  						Type: &Ydb.Type_DictType{
   790  							DictType: &Ydb.DictType{
   791  								Key: &Ydb.Type{
   792  									Type: &Ydb.Type_TypeId{
   793  										TypeId: Ydb.Type_UUID,
   794  									},
   795  								},
   796  								Payload: &Ydb.Type{
   797  									Type: &Ydb.Type_VoidType{},
   798  								},
   799  							},
   800  						},
   801  					},
   802  					Value: &Ydb.Value{
   803  						Pairs: []*Ydb.ValuePair{
   804  							{
   805  								Key: &Ydb.Value{
   806  									Value: &Ydb.Value_Low_128{
   807  										Low_128: 651345242494996240,
   808  									},
   809  									High_128: 72623859790382856,
   810  								},
   811  								Payload: &Ydb.Value{
   812  									Value: &Ydb.Value_NullFlagValue{},
   813  								},
   814  							},
   815  						},
   816  					},
   817  				},
   818  			},
   819  		},
   820  		{
   821  			name:    xtest.CurrentFileLine(),
   822  			builder: Builder{}.Param("$x").Set().AddItems(value.Uint64Value(123), value.Uint64Value(321)).Build(),
   823  			params: map[string]*Ydb.TypedValue{
   824  				"$x": {
   825  					Type: &Ydb.Type{
   826  						Type: &Ydb.Type_DictType{
   827  							DictType: &Ydb.DictType{
   828  								Key: &Ydb.Type{
   829  									Type: &Ydb.Type_TypeId{
   830  										TypeId: Ydb.Type_UINT64,
   831  									},
   832  								},
   833  								Payload: &Ydb.Type{
   834  									Type: &Ydb.Type_VoidType{},
   835  								},
   836  							},
   837  						},
   838  					},
   839  					Value: &Ydb.Value{
   840  						Pairs: []*Ydb.ValuePair{
   841  							{
   842  								Key: &Ydb.Value{
   843  									Value: &Ydb.Value_Uint64Value{
   844  										Uint64Value: 123,
   845  									},
   846  								},
   847  								Payload: &Ydb.Value{
   848  									Value: &Ydb.Value_NullFlagValue{},
   849  								},
   850  							},
   851  							{
   852  								Key: &Ydb.Value{
   853  									Value: &Ydb.Value_Uint64Value{
   854  										Uint64Value: 321,
   855  									},
   856  								},
   857  								Payload: &Ydb.Value{
   858  									Value: &Ydb.Value_NullFlagValue{},
   859  								},
   860  							},
   861  						},
   862  					},
   863  				},
   864  			},
   865  		},
   866  	} {
   867  		t.Run(tt.name, func(t *testing.T) {
   868  			a := allocator.New()
   869  			defer a.Free()
   870  			params := tt.builder.Build().ToYDB(a)
   871  			require.Equal(t, paramsToJSON(tt.params), paramsToJSON(params))
   872  		})
   873  	}
   874  }