-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for command JSON.STRAPPEND #501 #882
Conversation
42732bf
to
96a7d13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, looks good to me, just left a few suggestions. Thanks
4a4dabd
to
477a429
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, the changes look good to me. Thank you for addressing the comments.
@lucifercr07 can you merge this PR it's been reviewed |
@karandixit10 please resolve conflicts. |
internal/eval/eval_test.go
Outdated
@@ -2520,7 +2521,7 @@ func testEvalLLEN(t *testing.T, store *dstore.Store) { | |||
evalSET([]string{"EXISTING_KEY", "mock_value"}, store) | |||
}, | |||
input: []string{"EXISTING_KEY"}, | |||
output: []byte("-ERR Existing key has wrong Dice type\r\n"), | |||
output: []byte("-Existing key has wrong Dice type\r\n"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change in line with Redis output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, this return can to be updated. Currently the message in dice is: But in redis: I understand we have to replace dice with redis, but we have an extra ERR in the message which can be removed if we modify the
object.AssertTypeAndEncoding
with the following change:func AssertTypeAndEncoding(typeEncoding, expectedType, expectedEncoding uint8) []byte { if err := AssertType(typeEncoding, expectedType); err != nil { return diceerrors.NewErrWithMessage(diceerrors.WrongKeyTypeErr) } if err := AssertEncoding(typeEncoding, expectedEncoding); err != nil { return diceerrors.NewErrWithMessage(diceerrors.WrongKeyTypeErr) } return nil }
and add the following error in
errors.go
file:WrongKeyTypeErr = "-Existing key has wrong Dice type"
How do you feel about this suggestion.
Yeah It's same as the Dice output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's correct, if you pass a message prefixed with -
it's not prefixed with an error.
We don't need to change all the test cases in this case.
// NewErrWithMessage If the error code is already passed in the string,
// the error code provided is used, otherwise the string "-ERR " for the generic
// error code is automatically added. Note that 's' must NOT end with \r\n.
func NewErrWithMessage(errMsg string) []byte {
// If the string already starts with "-..." then the error code
// is provided by the caller. Otherwise, we use "-ERR".
if errMsg == "" || errMsg[0] != '-' {
errMsg = fmt.Sprintf(ErrDefault, errMsg)
}
return newDiceErr(errMsg).toEncodedMessage()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll revert it back to original
fd77940
to
d33bf19
Compare
Hi @lucifercr07 I have made the changes you can merge this now |
Hi @lucifercr07 conflicts are coming now, I'll fix those please merge them after that. |
2d46889
to
7f475ea
Compare
7f475ea
to
5e02034
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please resolve conflicts. We can merge.
5e02034
to
5a31a90
Compare
Hi @lucifercr07 , Resolved the confilcts. |
Fixes #501
Description
This pull request adds support for JSON.STRAPPEND command