@@ -1154,16 +1154,16 @@ func (client *ClusterClient) ConfigGetWithOptions(ctx context.Context,
11541154// OK - when connection name is set
11551155//
11561156// [valkey.io]: https://valkey.io/commands/client-setname/
1157- func (client * ClusterClient ) ClientSetName (ctx context.Context , connectionName string ) (models. ClusterValue [ string ] , error ) {
1157+ func (client * ClusterClient ) ClientSetName (ctx context.Context , connectionName string ) (string , error ) {
11581158 response , err := client .executeCommand (ctx , C .ClientSetName , []string {connectionName })
11591159 if err != nil {
1160- return models .CreateEmptyClusterValue [ string ]() , err
1160+ return models .DefaultStringResponse , err
11611161 }
11621162 data , err := handleOkResponse (response )
11631163 if err != nil {
1164- return models .CreateEmptyClusterValue [ string ]() , err
1164+ return models .DefaultStringResponse , err
11651165 }
1166- return models. CreateClusterSingleValue [ string ]( data ) , nil
1166+ return data , nil
11671167}
11681168
11691169// Set the name of the current connection.
@@ -1183,27 +1183,20 @@ func (client *ClusterClient) ClientSetName(ctx context.Context, connectionName s
11831183func (client * ClusterClient ) ClientSetNameWithOptions (ctx context.Context ,
11841184 connectionName string ,
11851185 opts options.RouteOption ,
1186- ) (models. ClusterValue [ string ] , error ) {
1186+ ) (string , error ) {
11871187 response , err := client .executeCommandWithRoute (ctx , C .ClientSetName , []string {connectionName }, opts .Route )
11881188 if err != nil {
1189- return models .CreateEmptyClusterValue [string ](), err
1190- }
1191- if opts .Route != nil &&
1192- (opts .Route ).IsMultiNode () {
1193- data , err := handleStringToStringMapResponse (response )
1194- if err != nil {
1195- return models .CreateEmptyClusterValue [string ](), err
1196- }
1197- return models.CreateClusterMultiValue [string ](data ), nil
1189+ return models .DefaultStringResponse , err
11981190 }
11991191 data , err := handleOkResponse (response )
12001192 if err != nil {
1201- return models .CreateEmptyClusterValue [ string ]() , err
1193+ return models .DefaultStringResponse , err
12021194 }
1203- return models. CreateClusterSingleValue [ string ]( data ) , nil
1195+ return data , nil
12041196}
12051197
12061198// Gets the name of the current connection.
1199+ // The command will be routed to a random node.
12071200//
12081201// See [valkey.io] for details.
12091202//
@@ -1213,19 +1206,20 @@ func (client *ClusterClient) ClientSetNameWithOptions(ctx context.Context,
12131206//
12141207// Return value:
12151208//
1216- // The name of the client connection as a string if a name is set, or nil if no name is assigned.
1209+ // If a name is set, returns the name of the client connection as a models.Result[string].
1210+ // Otherwise, returns [models.CreateNilStringResult()] if no name is assigned.
12171211//
12181212// [valkey.io]: https://valkey.io/commands/client-getname/
1219- func (client * ClusterClient ) ClientGetName (ctx context.Context ) (models.ClusterValue [string ], error ) {
1213+ func (client * ClusterClient ) ClientGetName (ctx context.Context ) (models.Result [string ], error ) {
12201214 response , err := client .executeCommand (ctx , C .ClientGetName , []string {})
12211215 if err != nil {
1222- return models .CreateEmptyClusterValue [ string ] (), err
1216+ return models .CreateNilStringResult (), err
12231217 }
1224- data , err := handleStringResponse (response )
1218+ data , err := handleStringOrNilResponse (response )
12251219 if err != nil {
1226- return models .CreateEmptyClusterValue [ string ] (), err
1220+ return models .CreateNilStringResult (), err
12271221 }
1228- return models. CreateClusterSingleValue [ string ]( data ) , nil
1222+ return data , nil
12291223}
12301224
12311225// Gets the name of the current connection.
@@ -1240,30 +1234,31 @@ func (client *ClusterClient) ClientGetName(ctx context.Context) (models.ClusterV
12401234//
12411235// Return value:
12421236//
1243- // The name of the client connection as a string if a name is set, or nil if no name is assigned.
1237+ // If a name is set, returns the name of the client connection as a ClusterValue wrapped models.Result[string].
1238+ // Otherwise, returns [models.CreateEmptyClusterValue[models.Result[string]]()] if no name is assigned.
12441239//
12451240// [valkey.io]: https://valkey.io/commands/client-getname/
12461241func (client * ClusterClient ) ClientGetNameWithOptions (
12471242 ctx context.Context ,
12481243 opts options.RouteOption ,
1249- ) (models.ClusterValue [string ], error ) {
1244+ ) (models.ClusterValue [models. Result [ string ] ], error ) {
12501245 response , err := client .executeCommandWithRoute (ctx , C .ClientGetName , []string {}, opts .Route )
12511246 if err != nil {
1252- return models .CreateEmptyClusterValue [string ](), err
1247+ return models .CreateEmptyClusterValue [models. Result [ string ] ](), err
12531248 }
12541249 if opts .Route != nil &&
12551250 (opts .Route ).IsMultiNode () {
1256- data , err := handleStringToStringMapResponse (response )
1251+ data , err := handleStringToStringOrNilMapResponse (response )
12571252 if err != nil {
1258- return models .CreateEmptyClusterValue [string ](), err
1253+ return models .CreateEmptyClusterValue [models. Result [ string ] ](), err
12591254 }
1260- return models.CreateClusterMultiValue [string ](data ), nil
1255+ return models.CreateClusterMultiValue [models. Result [ string ] ](data ), nil
12611256 }
1262- data , err := handleStringResponse (response )
1257+ data , err := handleStringOrNilResponse (response )
12631258 if err != nil {
1264- return models .CreateEmptyClusterValue [string ](), err
1259+ return models .CreateEmptyClusterValue [models. Result [ string ] ](), err
12651260 }
1266- return models.CreateClusterSingleValue [string ](data ), nil
1261+ return models.CreateClusterSingleValue [models. Result [ string ] ](data ), nil
12671262}
12681263
12691264// Rewrites the configuration file with the current configuration.
0 commit comments