Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: EdricCua <[email protected]>
  • Loading branch information
EdricCua committed Jan 21, 2025
1 parent 5d9a2f6 commit 9b9de5e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 63 deletions.
28 changes: 13 additions & 15 deletions go/api/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2953,16 +2953,15 @@ func (client *baseClient) XGroupDelConsumer(
//
// Return value:
//
// true if source was copied
// false if source was not copied.
// `true` if source was copied, `false` if source was not copied.
//
// Example:
//
// result, err := client.Copy([]string{"source, destination"})
// if err != nil {
// // handle error
// }
// fmt.Println(result) // Output: true
// result, err := client.Copy([]string{"source, destination"})
// if err != nil {
// // handle error
// }
// fmt.Println(result) // Output: true
//
// [valkey.io]: https://valkey.io/commands/copy/
func (client *baseClient) Copy(source string, destination string) (bool, error) {
Expand All @@ -2987,17 +2986,16 @@ func (client *baseClient) Copy(source string, destination string) (bool, error)

// Return value:
//
// true if source was copied
// false if source was not copied.
// `true` if source was copied, `false` if source was not copied.
//
// Example:
//
// copyOptions := api.NewCopyOptionsBuilder().SetDBDestination(2).SetReplace()
// result, err := client.Copy([]string{"source, destination",copyOptions})
// if err != nil {
// // handle error
// }
// fmt.Println(result) // Output: true
// copyOptions := api.NewCopyOptionsBuilder().SetDBDestination(2).SetReplace()
// result, err := client.Copy([]string{"source, destination",copyOptions})
// if err != nil {
// // handle error
// }
// fmt.Println(result) // Output: true
//
// [valkey.io]: https://valkey.io/commands/copy/
func (client *baseClient) CopyWithOptions(source string, destination string,
Expand Down
2 changes: 1 addition & 1 deletion go/api/command_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (opts *CopyOptions) toArgs() ([]string, error) {
if opts.replace != "" {
args = append(args, string(opts.replace))
}
if opts.dbDestination != 0 {
if opts.dbDestination != -0 {
args = append(args, "DB", utils.IntToString(opts.dbDestination))
}
return args, err
Expand Down
47 changes: 0 additions & 47 deletions go/api/generic_base_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,54 +704,7 @@ type GenericBaseCommands interface {
// [valkey.io]: https://valkey.io/commands/sort/
SortReadOnlyWithOptions(key string, sortOptions *options.SortOptions) ([]Result[string], error)

// Copies the value stored at the source to the destination key if the
// destination key does not yet exist.
//
// Note:
// When in cluster mode, both source and destination must map to the same hash slot.
//
// Parameters:
// source - The key to the source value.
// destination - The key where the value should be copied to.
//
// Return value:
// true if source was copied
// false if source was not copied.
//
// Example:
// result, err := client.Copy([]string{"source, destination"})
// if err != nil {
// // handle error
// }
// fmt.Println(result) // Output: true
//
// [valkey.io]: https://valkey.io/commands/copy/
Copy(source string, destination string) (bool, error)

// Copies the value stored at the source to the destination key. When
// replace is true, removes the destination key first if it already
// exists, otherwise performs no action.
//
// Note:
// When in cluster mode, both source and destination must map to the same hash slot.
//
// Parameters:
// source - The key to the source value.
// destination - The key where the value should be copied to.
// copyOptions - Set copy options with replace and DB destination-db

// Return value:
// true if source was copied
// false if source was not copied.
//
// Example:
// copyOptions := api.NewCopyOptionsBuilder().SetDBDestination(2).SetReplace()
// result, err := client.Copy([]string{"source, destination",copyOptions})
// if err != nil {
// // handle error
// }
// fmt.Println(result) // Output: true
//
// [valkey.io]: https://valkey.io/commands/copy/
CopyWithOptions(source string, destination string, option *CopyOptions) (bool, error)
}

0 comments on commit 9b9de5e

Please sign in to comment.