From c1472138627aa37f7f7c3279525b0e04b73d64ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Mathieu?= Date: Thu, 5 Jan 2023 11:28:35 +0100 Subject: [PATCH] feat(index): add options to index.exists function 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` --- algolia/search/index.go | 4 ++-- algolia/search/index_interface.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/algolia/search/index.go b/algolia/search/index.go index 664881cad..5338a6cca 100644 --- a/algolia/search/index.go +++ b/algolia/search/index.go @@ -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 } diff --git a/algolia/search/index_interface.go b/algolia/search/index_interface.go index 3b1375f23..c6978c7ab 100644 --- a/algolia/search/index_interface.go +++ b/algolia/search/index_interface.go @@ -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