Skip to content
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

Go: Implement Time Command #2963

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

niharikabhavaraju
Copy link
Collaborator

Go: Implement Time Command

Signed-off-by: Niharika Bhavaraju <[email protected]>
@niharikabhavaraju niharikabhavaraju requested a review from a team as a code owner January 16, 2025 19:24
go/api/server_management_commands.go Outdated Show resolved Hide resolved
go/api/server_management_commands.go Outdated Show resolved Hide resolved
go/api/base_client.go Outdated Show resolved Hide resolved
go/integTest/standalone_commands_test.go Outdated Show resolved Hide resolved
@Yury-Fridlyand Yury-Fridlyand added the go golang wrapper label Jan 16, 2025
@niharikabhavaraju
Copy link
Collaborator Author

@Yury-Fridlyand I have added Time for cluster (2x) can you please review.

Comment on lines +77 to +100
if err := checkResponseType(res, C.Map, true); err == nil {

// Multi-node response
mapData, err := handleRawStringArrayMapResponse(res)
if err != nil {
return ClusterValue[[]string]{
value: Result[[]string]{isNil: true},
}, err
}
var times []string
for _, nodeTimes := range mapData {
times = append(times, nodeTimes...)
}
return CreateClusterMultiValue(times), nil
}

// Single node response
data, err := handleRawStringArrayResponse(res)
if err != nil {
return ClusterValue[[]string]{
value: Result[[]string]{isNil: true},
}, err
}
return CreateClusterSingleValue(data), nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be that code be in response handlers?

Comment on lines +72 to +74
return ClusterValue[[]string]{
value: Result[[]string]{isNil: true},
}, err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use CreateEmptyClusterValue()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes there clash with #2965 and #2964, we should be careful on merging

//
// [valkey.io]: https://valkey.io/commands/#server
type ServerManagementClusterCommands interface {
Time(route route) (ClusterValue[[]string], error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be TimeWithRoute or TimeWithOptions, I prefer TimeWithOptions, see discussion in #2979 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go golang wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants