Skip to content

Commit ce1be6a

Browse files
crud: fix Get options
Before this patch, `vshard_router`, `fields`, `bucket_id`, `mode`, `prefer_replica`, `balance` were either ignored or had a wrong name. This patch fixes the issue.
1 parent f8ed81e commit ce1be6a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
5555
- Incorrect decoding of an MP_DECIMAL when the `scale` value is negative (#314)
5656
- Incorrect options (`after`, `batch_size` and `force_map_call`) setup for
5757
crud.SelectRequest (#320)
58+
- Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
59+
`prefer_replica`, `balance`) setup for crud.GetRequest (#335)
5860

5961
## [1.12.0] - 2023-06-07
6062

crud/get.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ func (opts GetOpts) EncodeMsgpack(enc *msgpack.Encoder) error {
4242
exists := [optsCnt]bool{}
4343
values[0], exists[0] = opts.Timeout.Get()
4444
values[1], exists[1] = opts.VshardRouter.Get()
45-
values[1], exists[1] = opts.BucketId.Get()
46-
values[2], exists[2] = opts.Mode.Get()
47-
values[3], exists[3] = opts.PreferReplica.Get()
48-
values[4], exists[4] = opts.Balance.Get()
45+
values[2], exists[2] = opts.Fields.Get()
46+
values[3], exists[3] = opts.BucketId.Get()
47+
values[4], exists[4] = opts.Mode.Get()
48+
values[5], exists[5] = opts.PreferReplica.Get()
49+
values[6], exists[6] = opts.Balance.Get()
4950

5051
return encodeOptions(enc, names[:], values[:], exists[:])
5152
}

crud/tarantool_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ var countOpts = crud.CountOpts{
5757

5858
var getOpts = crud.GetOpts{
5959
Timeout: crud.MakeOptUint(timeout),
60+
Mode: crud.MakeOptString("read"),
6061
}
6162

6263
var minOpts = crud.MinOpts{

0 commit comments

Comments
 (0)