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 @@ -51,6 +51,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
5151- Flaky decimal/TestSelect (#300 )
5252- Race condition at roundRobinStrategy.GetNextConnection() (#309 )
5353- Incorrect decoding of an MP_DECIMAL when the ` scale ` value is negative (#314 )
54+ - Incorrect options (` after ` , ` batch_size ` and ` force_map_call ` ) setup for
55+ crud.SelectRequest.
5456
5557## [ 1.12.0] - 2023-06-07
5658
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 @@ -63,9 +63,9 @@ func (opts SelectOpts) EncodeMsgpack(enc *msgpack.Encoder) error {
6363 values [6 ], exists [6 ] = opts .Balance .Get ()
6464 values [7 ], exists [7 ] = opts .First .Get ()
6565 values [8 ], exists [8 ] = opts .After .Get ()
66- values [8 ], exists [8 ] = opts .BatchSize .Get ()
67- values [8 ], exists [8 ] = opts .ForceMapCall .Get ()
68- values [8 ], exists [8 ] = opts .Fullscan .Get ()
66+ values [9 ], exists [9 ] = opts .BatchSize .Get ()
67+ values [10 ], exists [10 ] = opts .ForceMapCall .Get ()
68+ values [11 ], exists [11 ] = opts .Fullscan .Get ()
6969
7070 return encodeOptions (enc , names [:], values [:], exists [:])
7171}
You can’t perform that action at this time.
0 commit comments