diff --git a/go/api/base_client.go b/go/api/base_client.go index 8215551fb4..22a930a899 100644 --- a/go/api/base_client.go +++ b/go/api/base_client.go @@ -22,7 +22,7 @@ import ( "google.golang.org/protobuf/proto" ) -// BaseClient defines an interface for methods common to both [IGlideClient] and [GlideClusterClient]. +// BaseClient defines an interface for methods common to both [IGlideClient] and [IGlideClusterClient]. type BaseClient interface { StringCommands HashCommands @@ -1275,8 +1275,8 @@ func (client *baseClient) HScan(key string, cursor string) (string, []string, er // // Assume key contains a hash {{"a": "1"}, {"b", "2"}} // opts := options.NewHashScanOptionsBuilder().SetMatch("a") // resCursor, resCollection, err = client.HScan(key, initialCursor, opts) -// // resCursor = {0 false} -// // resCollection = [{a false} {1 false}] +// // resCursor = 0 +// // resCollection = [a 1] // // The resCollection only contains the hash map entry that matches with the match option provided with the command // // input. // diff --git a/go/api/glide_cluster_client.go b/go/api/glide_cluster_client.go index c8a0216563..7486487717 100644 --- a/go/api/glide_cluster_client.go +++ b/go/api/glide_cluster_client.go @@ -7,27 +7,27 @@ package api import "C" // GlideClusterClient interface compliance check. -var _ GlideClusterClient = (*glideClusterClient)(nil) +var _ IGlideClusterClient = (*GlideClusterClient)(nil) -// GlideClusterClient is a client used for connection in cluster mode. -type GlideClusterClient interface { +// IGlideClusterClient is a client used for connection in cluster mode. +type IGlideClusterClient interface { BaseClient GenericClusterCommands } -// glideClusterClient implements cluster mode operations by extending baseClient functionality. -type glideClusterClient struct { +// GlideClusterClient implements cluster mode operations by extending baseClient functionality. +type GlideClusterClient struct { *baseClient } -// NewGlideClusterClient creates a [GlideClusterClient] in cluster mode using the given [GlideClusterClientConfiguration]. -func NewGlideClusterClient(config *GlideClusterClientConfiguration) (GlideClusterClient, error) { +// NewGlideClusterClient creates a [IGlideClusterClient] in cluster mode using the given [GlideClusterClientConfiguration]. +func NewGlideClusterClient(config *GlideClusterClientConfiguration) (IGlideClusterClient, error) { client, err := createClient(config) if err != nil { return nil, err } - return &glideClusterClient{client}, nil + return &GlideClusterClient{client}, nil } // CustomCommand executes a single command, specified by args, without checking inputs. Every part of the command, @@ -57,7 +57,7 @@ func NewGlideClusterClient(config *GlideClusterClientConfiguration) (GlideCluste // result.Value().(string): "PONG" // // [Valkey GLIDE Wiki]: https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#custom-command -func (client *glideClusterClient) CustomCommand(args []string) (ClusterValue[interface{}], error) { +func (client *GlideClusterClient) CustomCommand(args []string) (ClusterValue[interface{}], error) { res, err := client.executeCommand(C.CustomCommand, args) if err != nil { return CreateEmptyClusterValue(), err diff --git a/go/integTest/glide_test_suite_test.go b/go/integTest/glide_test_suite_test.go index 0cd1bd445c..cbce0ed3ef 100644 --- a/go/integTest/glide_test_suite_test.go +++ b/go/integTest/glide_test_suite_test.go @@ -25,7 +25,7 @@ type GlideTestSuite struct { tls bool serverVersion string clients []api.IGlideClient - clusterClients []api.GlideClusterClient + clusterClients []api.IGlideClusterClient } var ( @@ -245,7 +245,7 @@ func (suite *GlideTestSuite) client(config *api.GlideClientConfiguration) api.IG return client } -func (suite *GlideTestSuite) defaultClusterClient() api.GlideClusterClient { +func (suite *GlideTestSuite) defaultClusterClient() api.IGlideClusterClient { config := api.NewGlideClusterClientConfiguration(). WithAddress(&suite.clusterHosts[0]). WithUseTLS(suite.tls). @@ -253,7 +253,7 @@ func (suite *GlideTestSuite) defaultClusterClient() api.GlideClusterClient { return suite.clusterClient(config) } -func (suite *GlideTestSuite) clusterClient(config *api.GlideClusterClientConfiguration) api.GlideClusterClient { +func (suite *GlideTestSuite) clusterClient(config *api.GlideClusterClientConfiguration) api.IGlideClusterClient { client, err := api.NewGlideClusterClient(config) assert.Nil(suite.T(), err) diff --git a/go/integTest/shared_commands_test.go b/go/integTest/shared_commands_test.go index 4d7ecdde73..0162418e30 100644 --- a/go/integTest/shared_commands_test.go +++ b/go/integTest/shared_commands_test.go @@ -4100,7 +4100,7 @@ func sendWithCustomCommand(suite *GlideTestSuite, client api.BaseClient, args [] switch c := client.(type) { case api.IGlideClient: res, err = c.CustomCommand(args) - case api.GlideClusterClient: + case api.IGlideClusterClient: res, err = c.CustomCommand(args) default: suite.FailNow(errMsg) @@ -5486,7 +5486,7 @@ func (suite *GlideTestSuite) TestXPending() { assert.Equal(suite.T(), streamid_2.Value(), detailResult[1].Id) } - execCluster := func(client api.GlideClusterClient) { + execCluster := func(client api.IGlideClusterClient) { // 1. Arrange the data key := uuid.New().String() groupName := "group" + uuid.New().String() @@ -5570,7 +5570,7 @@ func (suite *GlideTestSuite) TestXPending() { switch c := client.(type) { case api.IGlideClient: execStandalone(c) - case api.GlideClusterClient: + case api.IGlideClusterClient: execCluster(c) } }) @@ -5736,7 +5736,7 @@ func (suite *GlideTestSuite) TestXPendingFailures() { assert.True(suite.T(), strings.Contains(err.Error(), "WRONGTYPE")) } - execCluster := func(client api.GlideClusterClient) { + execCluster := func(client api.IGlideClusterClient) { // 1. Arrange the data key := uuid.New().String() missingKey := uuid.New().String() @@ -5894,7 +5894,7 @@ func (suite *GlideTestSuite) TestXPendingFailures() { switch c := client.(type) { case api.IGlideClient: execStandalone(c) - case api.GlideClusterClient: + case api.IGlideClusterClient: execCluster(c) } })