@@ -104,12 +104,14 @@ func (c chunkedBatchOption) chunkedBatch() {}
104
104
105
105
func (r requestOption) chunkedBatch() { }
106
106
107
+ // WithWaitForTasks whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
107
108
func WithWaitForTasks(waitForTasks bool) chunkedBatchOption {
108
109
return chunkedBatchOption(func(c *config) {
109
110
c.waitForTasks = waitForTasks
110
111
} )
111
112
}
112
113
114
+ // WithBatchSize the size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
113
115
func WithBatchSize(batchSize int) chunkedBatchOption {
114
116
return chunkedBatchOption(func(c *config) {
115
117
c.batchSize = batchSize
@@ -143,6 +145,7 @@ func (c chunkedBatchOption) partialUpdateObjects() {}
143
145
144
146
func (r requestOption) partialUpdateObjects() { }
145
147
148
+ // WithCreateIfNotExists to be provided if non-existing objects are passed, otherwise, the call will fail.
146
149
func WithCreateIfNotExists(createIfNotExists bool) partialUpdateObjectsOption {
147
150
return partialUpdateObjectsOption(func(c *config) {
148
151
c.createIfNotExists = createIfNotExists
@@ -176,6 +179,7 @@ func (c chunkedBatchOption) replaceAllObjects() {}
176
179
177
180
func (r requestOption) replaceAllObjects() { }
178
181
182
+ // WithScopes the `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
179
183
func WithScopes(scopes []ScopeType) replaceAllObjectsOption {
180
184
return replaceAllObjectsOption(func(c *config) {
181
185
c.scopes = scopes
@@ -204,18 +208,21 @@ func (r requestOption) iterable() {}
204
208
205
209
func (i iterableOption) iterable() { }
206
210
211
+ // WithMaxRetries the maximum number of retry. Default to 50.
207
212
func WithMaxRetries(maxRetries int) iterableOption {
208
213
return iterableOption(func(c *config) {
209
214
c.maxRetries = maxRetries
210
215
} )
211
216
}
212
217
218
+ // WithTimeout he function to decide how long to wait between retries. Default to min(retryCount * 200, 5000)
213
219
func WithTimeout(timeout func(int) time.Duration) iterableOption {
214
220
return iterableOption(func(c *config) {
215
221
c.timeout = timeout
216
222
} )
217
223
}
218
224
225
+ // WithAggregator the function to aggregate the results of the iterable.
219
226
func WithAggregator(aggregator func(any, error)) iterableOption {
220
227
return iterableOption(func(c *config) {
221
228
c.aggregator = aggregator
@@ -249,6 +256,7 @@ func (r requestOption) waitForApiKey() {}
249
256
250
257
func (i iterableOption) waitForApiKey() { }
251
258
259
+ // WithApiKey necessary to know if an `update` operation has been processed, compare fields of the response with it. (optional - mandatory if operation is UPDATE)
252
260
func WithApiKey(apiKey *ApiKey) waitForApiKeyOption {
253
261
return waitForApiKeyOption(func(c *config) {
254
262
c.apiKey = apiKey
0 commit comments