@@ -575,6 +575,21 @@ func ExampleConnectionPool_NewPrepared() {
575
575
}
576
576
}
577
577
578
+ func getTestTxnOpts () tarantool.Opts {
579
+ txnOpts := connOpts .Clone ()
580
+
581
+ // Assert that server supports expected protocol features
582
+ txnOpts .RequiredProtocolInfo = tarantool.ProtocolInfo {
583
+ Version : tarantool .ProtocolVersion (1 ),
584
+ Features : []tarantool.ProtocolFeature {
585
+ tarantool .StreamsFeature ,
586
+ tarantool .TransactionsFeature ,
587
+ },
588
+ }
589
+
590
+ return txnOpts
591
+ }
592
+
578
593
func ExampleCommitRequest () {
579
594
var req tarantool.Request
580
595
var resp * tarantool.Response
@@ -586,16 +601,7 @@ func ExampleCommitRequest() {
586
601
return
587
602
}
588
603
589
- // Assert that server supports expected features
590
- txnOpts := connOpts .Copy ()
591
- txnOpts .RequiredProtocolInfo = tarantool.ProtocolInfo {
592
- Version : tarantool .ProtocolVersion (1 ),
593
- Features : []tarantool.ProtocolFeature {
594
- tarantool .StreamsFeature ,
595
- tarantool .TransactionsFeature ,
596
- },
597
- }
598
-
604
+ txnOpts := getTestTxnOpts ()
599
605
pool , err := examplePool (testRoles , txnOpts )
600
606
if err != nil {
601
607
fmt .Println (err )
@@ -682,16 +688,7 @@ func ExampleRollbackRequest() {
682
688
return
683
689
}
684
690
685
- // Assert that server supports expected features
686
- txnOpts := connOpts .Copy ()
687
- txnOpts .RequiredProtocolInfo = tarantool.ProtocolInfo {
688
- Version : tarantool .ProtocolVersion (1 ),
689
- Features : []tarantool.ProtocolFeature {
690
- tarantool .StreamsFeature ,
691
- tarantool .TransactionsFeature ,
692
- },
693
- }
694
-
691
+ txnOpts := getTestTxnOpts ()
695
692
// example pool has only one rw instance
696
693
pool , err := examplePool (testRoles , txnOpts )
697
694
if err != nil {
@@ -778,16 +775,7 @@ func ExampleBeginRequest_TxnIsolation() {
778
775
return
779
776
}
780
777
781
- // Assert that server supports expected features
782
- txnOpts := connOpts .Copy ()
783
- txnOpts .RequiredProtocolInfo = tarantool.ProtocolInfo {
784
- Version : tarantool .ProtocolVersion (1 ),
785
- Features : []tarantool.ProtocolFeature {
786
- tarantool .StreamsFeature ,
787
- tarantool .TransactionsFeature ,
788
- },
789
- }
790
-
778
+ txnOpts := getTestTxnOpts ()
791
779
// example pool has only one rw instance
792
780
pool , err := examplePool (testRoles , txnOpts )
793
781
if err != nil {
0 commit comments