Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
Yury-Fridlyand committed Jan 13, 2025
1 parent 4426fd3 commit 8aa2d4d
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion go/api/response_handlers.go
Original file line number Diff line number Diff line change
@@ -274,7 +274,9 @@ func handleDoubleOrNullResponse(response *C.struct_CommandResponse) (Result[floa
if typeErr != nil {
return CreateNilFloat64Result(), typeErr
}

if response.response_type == C.Null {
return CreateNilFloat64Result(), nil
}
return CreateFloat64Result(float64(response.float_value)), nil
}

3 changes: 2 additions & 1 deletion go/api/sorted_set_commands.go
Original file line number Diff line number Diff line change
@@ -80,7 +80,8 @@ type SortedSetCommands interface {
// opts - The options for the command. See [ZAddOptions] for details.
//
// Return value:
// Result[float64] - The new score of the member.
// The new score of the member.
// If there was a conflict with the options, the operation aborts and `nil` is returned.
//
// Example:
// res, err := client.ZAddIncrWithOptions(key, "one", 1.0, options.NewZAddOptionsBuilder().SetChanged(true))
4 changes: 2 additions & 2 deletions go/integTest/shared_commands_test.go
Original file line number Diff line number Diff line change
@@ -4225,7 +4225,7 @@ func (suite *GlideTestSuite) TestZAddAndZAddIncr() {
assert.Equal(suite.T(), int64(3), res.Value())

resIncr, err = client.ZAddIncrWithOptions(key3, "one", 5, onlyIfDoesNotExistOpts)
assert.NotNil(suite.T(), err)
assert.Nil(suite.T(), err)
assert.True(suite.T(), resIncr.IsNil())

resIncr, err = client.ZAddIncrWithOptions(key3, "one", 5, onlyIfExistsOpts)
@@ -4263,7 +4263,7 @@ func (suite *GlideTestSuite) TestZAddAndZAddIncr() {
assert.Equal(suite.T(), float64(7), resIncr.Value())

resIncr, err = client.ZAddIncrWithOptions(key4, "one", -3, gtOpts)
assert.NotNil(suite.T(), err)
assert.Nil(suite.T(), err)
assert.True(suite.T(), resIncr.IsNil())
})
}

0 comments on commit 8aa2d4d

Please sign in to comment.