-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoption.go
66 lines (54 loc) · 1.1 KB
/
option.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2022 Axel Etcheverry. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package amplitude
import (
"net/http"
"time"
)
type Option func(*client)
func WithURL(url string) Option {
return func(c *client) {
c.endpoint = url
}
}
func WithTimeout(timeout time.Duration) Option {
return func(c *client) {
c.timeout = timeout
}
}
func WithInterval(interval time.Duration) Option {
return func(c *client) {
c.interval = interval
}
}
func WithBatchSize(size int) Option {
return func(c *client) {
c.batchSize = size
}
}
func WithBufferSize(size int) Option {
return func(c *client) {
c.bufferSize = size
}
}
func WithMaxRetry(retry int) Option {
return func(c *client) {
c.maxRetry = retry
}
}
func WithRetryInterval(interval time.Duration) Option {
return func(c *client) {
c.retryInterval = interval
}
}
func WithRetrySize(size int) Option {
return func(c *client) {
c.retrySize = size
}
}
func WithHTTPClient(httpClient *http.Client) Option {
return func(c *client) {
c.httpClient = httpClient
}
}