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 Custom Command with route(Generic Cluster cmd), Ping with Route #2979

Merged
merged 27 commits into from
Jan 29, 2025
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e25d23e
Custom Cmd(Generic Cluster cmd), Ping with Route
niharikabhavaraju Jan 20, 2025
d13523b
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 20, 2025
46ba328
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 20, 2025
b8a7720
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 21, 2025
b082b30
Added Ping , PingWithOptions
niharikabhavaraju Jan 22, 2025
91806cd
Minor changes
niharikabhavaraju Jan 22, 2025
17b1ed8
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 22, 2025
51884e6
Minor lint fix and error fix
niharikabhavaraju Jan 22, 2025
eb60104
Fixed failing tests
niharikabhavaraju Jan 22, 2025
0fd48d2
Fixed linting error
niharikabhavaraju Jan 22, 2025
2761f5d
Fixed lint error
niharikabhavaraju Jan 22, 2025
767e001
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 24, 2025
d6a5c21
Fixed review comments
niharikabhavaraju Jan 27, 2025
1de3c7d
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 27, 2025
2e3d2d7
Minor comments changes
niharikabhavaraju Jan 27, 2025
8ed86c5
Merge branch 'pingcommand-niharika' of github.com:niharikabhavaraju/v…
niharikabhavaraju Jan 27, 2025
6b9a527
Fixed indents
niharikabhavaraju Jan 27, 2025
7e2d86d
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 27, 2025
2ef3929
Fixed Response for Ping
niharikabhavaraju Jan 27, 2025
eacc4a8
Merge branch 'pingcommand-niharika' of github.com:niharikabhavaraju/v…
niharikabhavaraju Jan 27, 2025
b8cf9a5
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 28, 2025
d725726
Fixed code review comments
niharikabhavaraju Jan 28, 2025
88a7a23
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 28, 2025
ac3b8ff
Merge branch 'main' into pingcommand-niharika
niharikabhavaraju Jan 29, 2025
a3f6549
Fixed review comments and failing tests
niharikabhavaraju Jan 29, 2025
23b0bd3
Fixed failed tests
niharikabhavaraju Jan 29, 2025
2c04be7
Update go/api/glide_cluster_client.go
Yury-Fridlyand Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor lint fix and error fix
Signed-off-by: Niharika Bhavaraju <nbhavaraju@google.com>
niharikabhavaraju committed Jan 22, 2025
commit 51884e6df00b86573d60c2925ae616d57b84aa8c
6 changes: 5 additions & 1 deletion go/api/glide_cluster_client.go
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ package api
// #cgo LDFLAGS: -L../target/release -lglide_rs
// #include "../lib.h"
import "C"

import (
"github.com/valkey-io/valkey-glide/go/glide/api/config"
"github.com/valkey-io/valkey-glide/go/glide/api/options"
@@ -70,7 +71,10 @@ func (client *glideClusterClient) CustomCommand(args []string) (ClusterValue[int
// result.Value().(string): "PONG"
//
// [Valkey GLIDE Wiki]: https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#custom-command
func (client *glideClusterClient) CustomCommandWithRoute(args []string, route config.Route) (ClusterValue[interface{}], error) {
func (client *glideClusterClient) CustomCommandWithRoute(
args []string,
route config.Route,
) (ClusterValue[interface{}], error) {
res, err := client.executeCommandWithRoute(C.CustomCommand, args, route)
if err != nil {
return CreateEmptyClusterValue(), err
8 changes: 5 additions & 3 deletions go/api/response_handlers.go
Original file line number Diff line number Diff line change
@@ -210,7 +210,7 @@ func handle2DStringArrayResponse(response *C.struct_CommandResponse) ([][]string
}
res, ok := converted.([][]string)
if !ok {
return nil, &RequestError{fmt.Sprintf("unexpected type: %T", converted)}
return nil, &errors.RequestError{fmt.Sprintf("unexpected type: %T", converted)}
}
return res, nil
}
@@ -607,7 +607,9 @@ func (node mapConverter[T]) convert(data interface{}) (interface{}, error) {
// try direct conversion to T when there is no next converter
valueT, ok := value.(T)
if !ok {
return nil, &errors.RequestError{fmt.Sprintf("Unexpected type of map element: %T, expected: %v", value, getType[T]())}
return nil, &errors.RequestError{
fmt.Sprintf("Unexpected type of map element: %T, expected: %v", value, getType[T]()),
}
}
result[key] = valueT
} else {
@@ -707,7 +709,7 @@ func handleMapOfArrayOfStringArrayResponse(response *C.struct_CommandResponse) (
}
claimedEntries, ok := converted.(map[string][][]string)
if !ok {
return nil, &RequestError{fmt.Sprintf("unexpected type of second element: %T", converted)}
return nil, &errors.RequestError{fmt.Sprintf("unexpected type of second element: %T", converted)}
}

return claimedEntries, nil
Loading