-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
57 lines (45 loc) · 800 Bytes
/
config.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
package loong
import (
"context"
"log/slog"
)
type Config struct {
Store Storer
EventHandler EventHandler
templates TemplateGetter
IoCaller IoCaller
Txer Txer
Context context.Context
Logger *slog.Logger
}
type Option func(*Config)
func SetTxer(tx Txer) Option {
return func(e *Config) {
e.Txer = tx
}
}
func SetIoCaller(sc IoCaller) Option {
return func(e *Config) {
e.IoCaller = sc
}
}
func SetContext(ctx context.Context) Option {
return func(e *Config) {
e.Context = ctx
}
}
func SetStorer(s Storer) Option {
return func(e *Config) {
e.Store = s
}
}
func SetEventHandler(eh EventHandler) Option {
return func(e *Config) {
e.EventHandler = eh
}
}
func SetLogger(logger *slog.Logger) Option {
return func(e *Config) {
e.Logger = logger
}
}