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.
51
51
- Flaky decimal/TestSelect (#300 )
52
52
- Race condition at roundRobinStrategy.GetNextConnection() (#309 )
53
53
- 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 (#320 )
54
56
55
57
## [ 1.12.0] - 2023-06-07
56
58
Original file line number Diff line number Diff line change @@ -148,3 +148,41 @@ func ExampleResult_errorMany() {
148
148
// Output:
149
149
// Failed to execute request: CallError:
150
150
}
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 {
63
63
values [6 ], exists [6 ] = opts .Balance .Get ()
64
64
values [7 ], exists [7 ] = opts .First .Get ()
65
65
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 ()
69
69
70
70
return encodeOptions (enc , names [:], values [:], exists [:])
71
71
}
You can’t perform that action at this time.
0 commit comments