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

Replace variadic argument to all AddDocuments and UpdateDocuments methods #430

Open
3 tasks
alallema opened this issue Apr 24, 2023 · 0 comments
Open
3 tasks
Labels
enhancement New feature or request good first issue Good for newcomers maintenance Anything related to maintenance (CI, tests, refactoring...)

Comments

@alallema
Copy link
Contributor

alallema commented Apr 24, 2023

Description
Currently, we use variable parameters for all methods related to AddDocuments and UpdateDocuments to simplify the use of these methods. But this is not a good practice and it would be better to declare with normal parameters even if the user has to send nil for some of the unused parameters.

Basic example
Such as the method AddDocuments:

	AddDocuments(documentsPtr interface{}, primaryKey ...string) (resp *TaskInfo, err error)

Should become:

	AddDocuments(documentsPtr interface{}, primaryKey string) (resp *TaskInfo, err error)

And used as:

  documents := []map[string]interface{}{
    {
      "id":     287947,
      "title":  "Shazam ⚡️",
      "genres": "comedy",
    },
  }
  client.Index("movies").AddDocuments(documents, nil)

Other

  • Adapt the code of the methods
  • Adapt the tests
  • Update the code sample to the new usage
@alallema alallema added enhancement New feature or request maintenance Anything related to maintenance (CI, tests, refactoring...) labels Apr 25, 2023
@alallema alallema added the good first issue Good for newcomers label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers maintenance Anything related to maintenance (CI, tests, refactoring...)
Projects
None yet
Development

No branches or pull requests

1 participant