File tree Expand file tree Collapse file tree 3 files changed +43
-3
lines changed Expand file tree Collapse file tree 3 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
2121- Flaky decimal/TestSelect (#300 )
2222- Race condition at roundRobinStrategy.GetNextConnection() (#309 )
2323- Incorrect decoding of an MP_DECIMAL when the ` scale ` value is negative (#314 )
24+ - Incorrect options (` after ` , ` batch_size ` and ` force_map_call ` ) setup for
25+ crud.SelectRequest (#320 )
2426
2527## [ 1.12.0] - 2023-06-07
2628
Original file line number Diff line number Diff line change @@ -148,3 +148,41 @@ func ExampleResult_errorMany() {
148148 // Output:
149149 // Failed to execute request: CallError:
150150}
151+
152+ func ExampleSelectRequest_pagination () {
153+ conn := exampleConnect ()
154+
155+ const (
156+ fromTuple = 5
157+ allTuples = 10
158+ )
159+ var tuple interface {}
160+ for i := 0 ; i < allTuples ; i ++ {
161+ req := crud .MakeReplaceRequest (exampleSpace ).
162+ Tuple ([]interface {}{uint (3000 + i ), nil , "bla" })
163+ ret := crud.Result {}
164+ if err := conn .Do (req ).GetTyped (& ret ); err != nil {
165+ fmt .Printf ("Failed to initialize the example: %s\n " , err )
166+ return
167+ }
168+ if i == fromTuple {
169+ tuple = ret .Rows .([]interface {})[0 ]
170+ }
171+ }
172+
173+ req := crud .MakeSelectRequest (exampleSpace ).
174+ Opts (crud.SelectOpts {
175+ First : crud .MakeOptInt (2 ),
176+ After : crud .MakeOptTuple (tuple ),
177+ })
178+ ret := crud.Result {}
179+ if err := conn .Do (req ).GetTyped (& ret ); err != nil {
180+ fmt .Printf ("Failed to execute request: %s" , err )
181+ return
182+ }
183+ fmt .Println (ret .Metadata )
184+ fmt .Println (ret .Rows )
185+ // Output:
186+ // [{id unsigned false} {bucket_id unsigned true} {name string false}]
187+ // [[3006 32 bla] [3007 33 bla]]
188+ }
Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ func (opts SelectOpts) EncodeMsgpack(enc *encoder) error {
6161 values [6 ], exists [6 ] = opts .Balance .Get ()
6262 values [7 ], exists [7 ] = opts .First .Get ()
6363 values [8 ], exists [8 ] = opts .After .Get ()
64- values [8 ], exists [8 ] = opts .BatchSize .Get ()
65- values [8 ], exists [8 ] = opts .ForceMapCall .Get ()
66- values [8 ], exists [8 ] = opts .Fullscan .Get ()
64+ values [9 ], exists [9 ] = opts .BatchSize .Get ()
65+ values [10 ], exists [10 ] = opts .ForceMapCall .Get ()
66+ values [11 ], exists [11 ] = opts .Fullscan .Get ()
6767
6868 return encodeOptions (enc , names [:], values [:], exists [:])
6969}
You can’t perform that action at this time.
0 commit comments