-
Notifications
You must be signed in to change notification settings - Fork 10
/
token_store_options.go
41 lines (34 loc) · 1.17 KB
/
token_store_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
package pg
import "time"
// TokenStoreOption is the configuration options type for token store
type TokenStoreOption func(s *TokenStore)
// WithTokenStoreTableName returns option that sets token store table name
func WithTokenStoreTableName(tableName string) TokenStoreOption {
return func(s *TokenStore) {
s.tableName = tableName
}
}
// WithTokenStoreGCInterval returns option that sets token store garbage collection interval
func WithTokenStoreGCInterval(gcInterval time.Duration) TokenStoreOption {
return func(s *TokenStore) {
s.gcInterval = gcInterval
}
}
// WithTokenStoreLogger returns option that sets token store logger implementation
func WithTokenStoreLogger(logger Logger) TokenStoreOption {
return func(s *TokenStore) {
s.logger = logger
}
}
// WithTokenStoreGCDisabled returns option that disables token store garbage collection
func WithTokenStoreGCDisabled() TokenStoreOption {
return func(s *TokenStore) {
s.gcDisabled = true
}
}
// WithTokenStoreInitTableDisabled returns option that disables table creation on token store instantiation
func WithTokenStoreInitTableDisabled() TokenStoreOption {
return func(s *TokenStore) {
s.initTableDisabled = true
}
}