mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
parent
1037f446a2
commit
bf0f7ec234
1 changed files with 9 additions and 2 deletions
|
@ -1141,9 +1141,16 @@ void HSetFamily::HRandField(CmdArgList args, ConnectionContext* cntx) {
|
|||
auto* rb = static_cast<RedisReplyBuilder*>(cntx->reply_builder());
|
||||
OpResult<StringVec> result = cntx->transaction->ScheduleSingleHopT(std::move(cb));
|
||||
if (result) {
|
||||
rb->SendStringArr(*result);
|
||||
if ((result->size() == 1) && (args.size() == 1))
|
||||
rb->SendBulkString(result->front());
|
||||
else {
|
||||
rb->SendStringArr(*result, facade::RedisReplyBuilder::MAP);
|
||||
}
|
||||
} else if (result.status() == OpStatus::KEY_NOTFOUND) {
|
||||
rb->SendNull();
|
||||
if (args.size() == 1)
|
||||
rb->SendNull();
|
||||
else
|
||||
rb->SendEmptyArray();
|
||||
} else {
|
||||
rb->SendError(result.status());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue