Skip to content

Commit

Permalink
crud: fix Get options
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DifferentialOrange committed Oct 5, 2023
1 parent f8ed81e commit ce1be6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
- Incorrect decoding of an MP_DECIMAL when the `scale` value is negative (#314)
- Incorrect options (`after`, `batch_size` and `force_map_call`) setup for
crud.SelectRequest (#320)
- Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
`prefer_replica`, `balance`) setup for crud.GetRequest (#335)

## [1.12.0] - 2023-06-07

Expand Down
9 changes: 5 additions & 4 deletions crud/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ func (opts GetOpts) EncodeMsgpack(enc *msgpack.Encoder) error {
exists := [optsCnt]bool{}
values[0], exists[0] = opts.Timeout.Get()
values[1], exists[1] = opts.VshardRouter.Get()
values[1], exists[1] = opts.BucketId.Get()
values[2], exists[2] = opts.Mode.Get()
values[3], exists[3] = opts.PreferReplica.Get()
values[4], exists[4] = opts.Balance.Get()
values[2], exists[2] = opts.Fields.Get()
values[3], exists[3] = opts.BucketId.Get()
values[4], exists[4] = opts.Mode.Get()
values[5], exists[5] = opts.PreferReplica.Get()
values[6], exists[6] = opts.Balance.Get()

return encodeOptions(enc, names[:], values[:], exists[:])
}
Expand Down
1 change: 1 addition & 0 deletions crud/tarantool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var countOpts = crud.CountOpts{

var getOpts = crud.GetOpts{
Timeout: crud.MakeOptUint(timeout),
Mode: crud.MakeOptString("read"),
}

var minOpts = crud.MinOpts{
Expand Down

0 comments on commit ce1be6a

Please sign in to comment.