@@ -570,8 +570,13 @@ func ExampleExecuteRequest() {
570
570
data , err := resp .Decode ()
571
571
fmt .Println ("Error" , err )
572
572
fmt .Println ("Data" , data )
573
- fmt .Println ("MetaData" , resp .MetaData ())
574
- fmt .Println ("SQL Info" , resp .SQLInfo ())
573
+ exResp , ok := resp .(* tarantool.PrepareExecuteResponse )
574
+ if ! ok {
575
+ fmt .Printf ("wrong response type" )
576
+ return
577
+ }
578
+ fmt .Println ("MetaData" , exResp .MetaData ())
579
+ fmt .Println ("SQL Info" , exResp .SQLInfo ())
575
580
576
581
// There are 4 options to pass named parameters to an SQL query:
577
582
// 1) The simple map;
@@ -608,8 +613,13 @@ func ExampleExecuteRequest() {
608
613
data , err = resp .Decode ()
609
614
fmt .Println ("Error" , err )
610
615
fmt .Println ("Data" , data )
611
- fmt .Println ("MetaData" , resp .MetaData ())
612
- fmt .Println ("SQL Info" , resp .SQLInfo ())
616
+ exResp , ok = resp .(* tarantool.PrepareExecuteResponse )
617
+ if ! ok {
618
+ fmt .Printf ("wrong response type" )
619
+ return
620
+ }
621
+ fmt .Println ("MetaData" , exResp .MetaData ())
622
+ fmt .Println ("SQL Info" , exResp .SQLInfo ())
613
623
614
624
// 2)
615
625
req = req .Args (sqlBind2 )
@@ -619,8 +629,13 @@ func ExampleExecuteRequest() {
619
629
data , err = resp .Decode ()
620
630
fmt .Println ("Error" , err )
621
631
fmt .Println ("Data" , data )
622
- fmt .Println ("MetaData" , resp .MetaData ())
623
- fmt .Println ("SQL Info" , resp .SQLInfo ())
632
+ exResp , ok = resp .(* tarantool.PrepareExecuteResponse )
633
+ if ! ok {
634
+ fmt .Printf ("wrong response type" )
635
+ return
636
+ }
637
+ fmt .Println ("MetaData" , exResp .MetaData ())
638
+ fmt .Println ("SQL Info" , exResp .SQLInfo ())
624
639
625
640
// 3)
626
641
req = req .Args (sqlBind3 )
@@ -630,8 +645,13 @@ func ExampleExecuteRequest() {
630
645
data , err = resp .Decode ()
631
646
fmt .Println ("Error" , err )
632
647
fmt .Println ("Data" , data )
633
- fmt .Println ("MetaData" , resp .MetaData ())
634
- fmt .Println ("SQL Info" , resp .SQLInfo ())
648
+ exResp , ok = resp .(* tarantool.PrepareExecuteResponse )
649
+ if ! ok {
650
+ fmt .Printf ("wrong response type" )
651
+ return
652
+ }
653
+ fmt .Println ("MetaData" , exResp .MetaData ())
654
+ fmt .Println ("SQL Info" , exResp .SQLInfo ())
635
655
636
656
// 4)
637
657
req = req .Args (sqlBind4 )
@@ -641,8 +661,13 @@ func ExampleExecuteRequest() {
641
661
data , err = resp .Decode ()
642
662
fmt .Println ("Error" , err )
643
663
fmt .Println ("Data" , data )
644
- fmt .Println ("MetaData" , resp .MetaData ())
645
- fmt .Println ("SQL Info" , resp .SQLInfo ())
664
+ exResp , ok = resp .(* tarantool.PrepareExecuteResponse )
665
+ if ! ok {
666
+ fmt .Printf ("wrong response type" )
667
+ return
668
+ }
669
+ fmt .Println ("MetaData" , exResp .MetaData ())
670
+ fmt .Println ("SQL Info" , exResp .SQLInfo ())
646
671
647
672
// The way to pass positional arguments to an SQL query.
648
673
req = tarantool .NewExecuteRequest (
@@ -654,8 +679,13 @@ func ExampleExecuteRequest() {
654
679
data , err = resp .Decode ()
655
680
fmt .Println ("Error" , err )
656
681
fmt .Println ("Data" , data )
657
- fmt .Println ("MetaData" , resp .MetaData ())
658
- fmt .Println ("SQL Info" , resp .SQLInfo ())
682
+ exResp , ok = resp .(* tarantool.PrepareExecuteResponse )
683
+ if ! ok {
684
+ fmt .Printf ("wrong response type" )
685
+ return
686
+ }
687
+ fmt .Println ("MetaData" , exResp .MetaData ())
688
+ fmt .Println ("SQL Info" , exResp .SQLInfo ())
659
689
660
690
// The way to pass SQL expression with using custom packing/unpacking for
661
691
// a type.
@@ -680,8 +710,13 @@ func ExampleExecuteRequest() {
680
710
data , err = resp .Decode ()
681
711
fmt .Println ("Error" , err )
682
712
fmt .Println ("Data" , data )
683
- fmt .Println ("MetaData" , resp .MetaData ())
684
- fmt .Println ("SQL Info" , resp .SQLInfo ())
713
+ exResp , ok = resp .(* tarantool.PrepareExecuteResponse )
714
+ if ! ok {
715
+ fmt .Printf ("wrong response type" )
716
+ return
717
+ }
718
+ fmt .Println ("MetaData" , exResp .MetaData ())
719
+ fmt .Println ("SQL Info" , exResp .SQLInfo ())
685
720
}
686
721
687
722
func getTestTxnDialer () tarantool.Dialer {
0 commit comments