-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtoken_store_options.go
34 lines (28 loc) · 1005 Bytes
/
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
package mysql
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
}
}
// 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
}
}