From ce1be6abed5a38b92f1afef8426591de394d3f92 Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Thu, 5 Oct 2023 18:26:27 +0300 Subject: [PATCH] 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. --- CHANGELOG.md | 2 ++ crud/get.go | 9 +++++---- crud/tarantool_test.go | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 211ea25a2..020a37c70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/crud/get.go b/crud/get.go index e1855f35c..a957219dc 100644 --- a/crud/get.go +++ b/crud/get.go @@ -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[:]) } diff --git a/crud/tarantool_test.go b/crud/tarantool_test.go index 5cf29f66a..576d973e8 100644 --- a/crud/tarantool_test.go +++ b/crud/tarantool_test.go @@ -57,6 +57,7 @@ var countOpts = crud.CountOpts{ var getOpts = crud.GetOpts{ Timeout: crud.MakeOptUint(timeout), + Mode: crud.MakeOptString("read"), } var minOpts = crud.MinOpts{