-
Notifications
You must be signed in to change notification settings - Fork 0
/
option.go
101 lines (85 loc) · 2.05 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package welfare
import (
"time"
"github.com/houseme/gocrypto"
"github.com/houseme/welfare-go/internal"
"github.com/houseme/welfare-go/pkg/log"
)
// WithVersion .
func WithVersion(version string) internal.Option {
return func(o *internal.Options) {
o.Version = version
}
}
// WithFormat .
func WithFormat(format string) internal.Option {
return func(o *internal.Options) {
o.Format = format
}
}
// WithEncryptType .
func WithEncryptType(encryptType string) internal.Option {
return func(o *internal.Options) {
o.EncryptType = encryptType
}
}
// WithSignType .
func WithSignType(signType string) internal.Option {
return func(o *internal.Options) {
o.SignType = signType
}
}
// WithPublicKey .
func WithPublicKey(publicKey string) internal.Option {
return func(o *internal.Options) {
o.PublicKey = publicKey
}
}
// WithPrivateKey .
func WithPrivateKey(privateKey string) internal.Option {
return func(o *internal.Options) {
o.PrivateKey = privateKey
}
}
// WithPublicKeyDataType .
func WithPublicKeyDataType(dataType gocrypto.Encode) internal.Option {
return func(o *internal.Options) {
o.PublicKeyDataType = dataType
}
}
// WithPrivateKeyDataType .
func WithPrivateKeyDataType(dataType gocrypto.Encode) internal.Option {
return func(o *internal.Options) {
o.PrivateKeyDataType = dataType
}
}
// WithPrivateKeyType .
func WithPrivateKeyType(keyType gocrypto.Secret) internal.Option {
return func(o *internal.Options) {
o.PrivateKeyType = keyType
}
}
// WithTimeout the Timeout option.
func WithTimeout(timeout time.Duration) internal.Option {
return func(o *internal.Options) {
o.Timeout = timeout
}
}
// WithRetryCount with RetryCount option.
func WithRetryCount(retryCount int) internal.Option {
return func(o *internal.Options) {
o.RetryCount = retryCount
}
}
// WithLogPath .
func WithLogPath(logPath string) internal.Option {
return func(o *internal.Options) {
o.LogPath = logPath
}
}
// WithLoglevel .
func WithLoglevel(loglevel log.Level) internal.Option {
return func(o *internal.Options) {
o.Loglevel = loglevel
}
}