-
Notifications
You must be signed in to change notification settings - Fork 2
/
option.go
39 lines (32 loc) · 806 Bytes
/
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
package dataloader
import (
"time"
"go.opentelemetry.io/otel/trace"
)
// Option is a function type for configuring DataLoader
type Option func(*config)
// WithCache sets the cache size for the DataLoader
func WithCache(size int, expire time.Duration) Option {
return func(c *config) {
c.CacheSize = size
c.CacheExpire = expire
}
}
// WithBatchSize sets the batch size for the DataLoader
func WithBatchSize(size int) Option {
return func(c *config) {
c.BatchSize = size
}
}
// WithWait sets the wait duration for the DataLoader
func WithWait(wait time.Duration) Option {
return func(c *config) {
c.Wait = wait
}
}
// WithTracerProvider sets the tracer for the DataLoader
func WithTracerProvider(tp trace.TracerProvider) Option {
return func(c *config) {
c.TracerProvider = tp
}
}