Skip to content

Commit 430b80d

Browse files
committed
add some coms
1 parent bd696d9 commit 430b80d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

templates/go/api.mustache

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,14 @@ func (c chunkedBatchOption) chunkedBatch() {}
104104

105105
func (r requestOption) chunkedBatch() {}
106106

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.
107108
func WithWaitForTasks(waitForTasks bool) chunkedBatchOption {
108109
return chunkedBatchOption(func(c *config) {
109110
c.waitForTasks = waitForTasks
110111
})
111112
}
112113

114+
// WithBatchSize the size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
113115
func WithBatchSize(batchSize int) chunkedBatchOption {
114116
return chunkedBatchOption(func(c *config) {
115117
c.batchSize = batchSize
@@ -143,6 +145,7 @@ func (c chunkedBatchOption) partialUpdateObjects() {}
143145

144146
func (r requestOption) partialUpdateObjects() {}
145147

148+
// WithCreateIfNotExists to be provided if non-existing objects are passed, otherwise, the call will fail.
146149
func WithCreateIfNotExists(createIfNotExists bool) partialUpdateObjectsOption {
147150
return partialUpdateObjectsOption(func(c *config) {
148151
c.createIfNotExists = createIfNotExists
@@ -176,6 +179,7 @@ func (c chunkedBatchOption) replaceAllObjects() {}
176179

177180
func (r requestOption) replaceAllObjects() {}
178181

182+
// WithScopes the `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
179183
func WithScopes(scopes []ScopeType) replaceAllObjectsOption {
180184
return replaceAllObjectsOption(func(c *config) {
181185
c.scopes = scopes
@@ -204,18 +208,21 @@ func (r requestOption) iterable() {}
204208

205209
func (i iterableOption) iterable() {}
206210

211+
// WithMaxRetries the maximum number of retry. Default to 50.
207212
func WithMaxRetries(maxRetries int) iterableOption {
208213
return iterableOption(func(c *config) {
209214
c.maxRetries = maxRetries
210215
})
211216
}
212217

218+
// WithTimeout he function to decide how long to wait between retries. Default to min(retryCount * 200, 5000)
213219
func WithTimeout(timeout func(int) time.Duration) iterableOption {
214220
return iterableOption(func(c *config) {
215221
c.timeout = timeout
216222
})
217223
}
218224

225+
// WithAggregator the function to aggregate the results of the iterable.
219226
func WithAggregator(aggregator func(any, error)) iterableOption {
220227
return iterableOption(func(c *config) {
221228
c.aggregator = aggregator
@@ -249,6 +256,7 @@ func (r requestOption) waitForApiKey() {}
249256

250257
func (i iterableOption) waitForApiKey() {}
251258

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)
252260
func WithApiKey(apiKey *ApiKey) waitForApiKeyOption {
253261
return waitForApiKeyOption(func(c *config) {
254262
c.apiKey = apiKey

0 commit comments

Comments
 (0)