Skip to content

Commit

Permalink
feat(index): add options to index.exists function
Browse files Browse the repository at this point in the history
Currently the function `index.Exists` doesn't accept options like other functions.

Options can be used to propagate the context, for example to do tracing. The goal of this commit is to add `opts` to `index.exists`
  • Loading branch information
k20human committed Jan 5, 2023
1 parent f9f9ebb commit 8be69f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions algolia/search/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func (i *Index) GetStatus(taskID int64, opts ...interface{}) (res TaskStatusRes,
// Exists returns whether an initialized index exists or not, along with a nil
// error. When encountering a network error, a non-nil error is returned along
// with false.
func (i *Index) Exists() (bool, error) {
_, err := i.GetSettings()
func (i *Index) Exists(opts ...interface{}) (bool, error) {
_, err := i.GetSettings(opts)
if err == nil {
return true, nil
}
Expand Down
2 changes: 1 addition & 1 deletion algolia/search/index_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type IndexInterface interface {
GetName() string
ClearObjects(opts ...interface{}) (res UpdateTaskRes, err error)
Delete(opts ...interface{}) (res DeleteTaskRes, err error)
Exists() (exists bool, err error)
Exists(opts ...interface{}) (exists bool, err error)

// Indexing
GetObject(objectID string, object interface{}, opts ...interface{}) error
Expand Down

0 comments on commit 8be69f4

Please sign in to comment.