File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -409,6 +409,25 @@ func TestBuilder(t *testing.T) {
409409 },
410410 },
411411 },
412+ {
413+ name : xtest .CurrentFileLine (),
414+ builder : Builder {}.
415+ Param ("$x" ).Yson ([]byte (`[ 1; 2; 3; 4; 5 ]` )).Build (),
416+ params : map [string ]* Ydb.TypedValue {
417+ "$x" : {
418+ Type : & Ydb.Type {
419+ Type : & Ydb.Type_TypeId {
420+ TypeId : Ydb .Type_YSON ,
421+ },
422+ },
423+ Value : & Ydb.Value {
424+ Value : & Ydb.Value_BytesValue {
425+ BytesValue : []byte (`[ 1; 2; 3; 4; 5 ]` ),
426+ },
427+ },
428+ },
429+ },
430+ },
412431 } {
413432 t .Run (tt .name , func (t * testing.T ) {
414433 a := allocator .New ()
Original file line number Diff line number Diff line change @@ -146,3 +146,9 @@ func (p *optional) JsonDocument(v string) *optionalBuilder {
146146
147147 return & optionalBuilder {opt : p }
148148}
149+
150+ func (p * optional ) Yson (v []byte ) * optionalBuilder {
151+ p .value = value .YSONValue (v )
152+
153+ return & optionalBuilder {opt : p }
154+ }
Original file line number Diff line number Diff line change @@ -501,6 +501,30 @@ func TestOptional(t *testing.T) {
501501 },
502502 },
503503 },
504+ {
505+ name : xtest .CurrentFileLine (),
506+ builder : Builder {}.Param ("$x" ).Optional ().Yson ([]byte (`[ 1; 2; 3; 4; 5 ]` )).Build (),
507+ params : map [string ]* Ydb.TypedValue {
508+ "$x" : {
509+ Type : & Ydb.Type {
510+ Type : & Ydb.Type_OptionalType {
511+ OptionalType : & Ydb.OptionalType {
512+ Item : & Ydb.Type {
513+ Type : & Ydb.Type_TypeId {
514+ TypeId : Ydb .Type_YSON ,
515+ },
516+ },
517+ },
518+ },
519+ },
520+ Value : & Ydb.Value {
521+ Value : & Ydb.Value_BytesValue {
522+ BytesValue : []byte (`[ 1; 2; 3; 4; 5 ]` ),
523+ },
524+ },
525+ },
526+ },
527+ },
504528 } {
505529 t .Run (tt .name , func (t * testing.T ) {
506530 a := allocator .New ()
Original file line number Diff line number Diff line change @@ -256,6 +256,13 @@ func (p *Parameter) JsonDocument(v string) Builder {
256256 return p .parent
257257}
258258
259+ func (p * Parameter ) Yson (v []byte ) Builder {
260+ p .value = value .YSONValue (v )
261+ p .parent .params = append (p .parent .params , p )
262+
263+ return p .parent
264+ }
265+
259266func Declare (p * Parameter ) string {
260267 return fmt .Sprintf (
261268 "DECLARE %s AS %s" ,
You can’t perform that action at this time.
0 commit comments