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: Add command GeoSearch #3385

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

Go: Add command GeoSearch #3385

wants to merge 4 commits into from

Conversation

tjzhang-BQ
Copy link
Collaborator

Issue link

This Pull Request is linked to issue (URL): [REPLACE ME]

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Create merge commit if merging release branch into main, squash otherwise.

Signed-off-by: TJ Zhang <[email protected]>
@tjzhang-BQ tjzhang-BQ added the go golang wrapper label Mar 18, 2025
@tjzhang-BQ tjzhang-BQ changed the title Go: Add command Go: Add command GeoSearch Mar 19, 2025
Signed-off-by: TJ Zhang <[email protected]>
Signed-off-by: TJ Zhang <[email protected]>
@tjzhang-BQ tjzhang-BQ marked this pull request as ready for review March 20, 2025 00:26
@tjzhang-BQ tjzhang-BQ requested a review from a team as a code owner March 20, 2025 00:26
Comment on lines +6573 to +6596
searchFromArgs, err := searchFrom.ToArgs()
if err != nil {
return nil, err
}
args = append(args, searchFromArgs...)
searchByShapeArgs, err := searchByShape.ToArgs()
if err != nil {
return nil, err
}
args = append(args, searchByShapeArgs...)
infoOptionsArgs, err := infoOptions.ToArgs()
if err != nil {
return nil, err
}
args = append(args, infoOptionsArgs...)
resultOptionsArgs, err := resultOptions.ToArgs()
if err != nil {
return nil, err
}
args = append(args, resultOptionsArgs...)
result, err := client.executeCommand(C.GeoSearch, args)
if err != nil {
return nil, err
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could probably move this common part to another method

//
// Parameters:
//
// key - The key of the sorted set.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh why such big idents?

searchFrom options.GeoSearchOrigin,
searchByShape options.GeoSearchShape,
infoOptions options.GeoSearchInfoOptions,
) ([]any, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we create a custom return type there?

// The unit of measurement for the geospatial data
type GeoUnit string

const (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why there?

ToArgs() ([]string, error)
}

const (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move to const?

// The shape of the search area for the `GeoSearch` command
type SearchShape string

const (
Copy link
Collaborator

Choose a reason for hiding this comment

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

and this

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