-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathoption.go
40 lines (31 loc) · 875 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
40
package goredis8
import "github.com/go-redis/redis/v8"
// WithMulti sets up sql.TxOptions for the Settings.
func WithMulti(isMulti bool) Opt {
return func(s *Settings) error {
s.setIsMulti(&isMulti)
return nil
}
}
// WithWatchKeys sets WATCH keys in Transaction.
func WithWatchKeys(keys ...string) Opt {
return func(s *Settings) error {
s.setWatchKeys(keys)
return nil
}
}
// WithTxDecorator sets TxDecorator to change behavior of Transaction.
func WithTxDecorator(in TxDecorator) Opt {
return func(s *Settings) error {
s.setTxDecorator(in)
return nil
}
}
// WithRet sets link on []redis.Cmder to get responses of commands in Transaction
// WARNING: Responses don't clean automatically, use WithRet only with DoWithSettings of trm.Manager.
func WithRet(in *[]redis.Cmder) Opt {
return func(s *Settings) error {
s.SetReturn(in)
return nil
}
}