-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
51 lines (41 loc) · 957 Bytes
/
options.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
package parser
import (
"time"
"github.com/ilkamo/ethparser-go/types"
)
type Option func(p *Parser)
func WithBlockProcessTimeout(timeout time.Duration) Option {
return func(p *Parser) {
p.blocksProcessTimeout = timeout
}
}
func WithLogger(logger types.Logger) Option {
return func(p *Parser) {
p.logger = logger
}
}
func WithEthereumClient(client EthereumClient) Option {
return func(p *Parser) {
p.ethClient = client
}
}
func WithTransactionsRepo(repo TransactionsRepository) Option {
return func(p *Parser) {
p.transactionsRepo = repo
}
}
func WithAddressesRepo(repo AddressesRepository) Option {
return func(p *Parser) {
p.addressesRepository = repo
}
}
func WithNoNewBlocksPause(duration time.Duration) Option {
return func(p *Parser) {
p.noNewBlocksPause = duration
}
}
func WithMaxBlocksToProcessInParallel(maxBlocks int) Option {
return func(p *Parser) {
p.maxNumberOfBlocksToProcessInParallel = maxBlocks
}
}