Documentation ¶
Index ¶
- type Option
- func WithAccess(duration time.Duration) Option
- func WithBucket(bucket []byte) Option
- func WithCheckBatch(batch int) Option
- func WithClear(duration time.Duration) Option
- func WithDB(db *bolt.DB) Option
- func WithFileMode(mode os.FileMode) Option
- func WithFilename(filename string) Option
- func WithMaxSize(maxSize int) Option
- func WithRefresh(duration time.Duration) Option
- func WithTimeout(timeout time.Duration) Option
- type Provider
- func (p *Provider) Check(ctx context.Context, token string) (e error)
- func (p *Provider) Clear() (e error)
- func (p *Provider) Close() (e error)
- func (p *Provider) Create(ctx context.Context, access, refresh string, pair []sessionid.PairBytes) (e error)
- func (p *Provider) Delete(ctx context.Context, token string, keys []string) (err error)
- func (p *Provider) Destroy(ctx context.Context, id string) (e error)
- func (p *Provider) DestroyByToken(ctx context.Context, token string) (e error)
- func (p *Provider) Get(ctx context.Context, token string, keys []string) (vals []sessionid.Value, e error)
- func (p *Provider) Keys(ctx context.Context, token string) (keys []string, e error)
- func (p *Provider) Put(ctx context.Context, token string, pair []sessionid.PairBytes) (err error)
- func (p *Provider) Refresh(ctx context.Context, access, refresh, newAccess, newRefresh string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithAccess ¶
WithAccess set the valid time of access token, at least one second.
func WithBucket ¶
func WithFileMode ¶
func WithFilename ¶
func WithMaxSize ¶
WithMaxSize maximum number of tokens saved, if <= 0 not limit
func WithRefresh ¶
WithRefresh set the valid time of refresh token, at least one second.
func WithTimeout ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider a provider store data on local bolt database
func (*Provider) Create ¶
func (p *Provider) Create(ctx context.Context, access, refresh string, pair []sessionid.PairBytes, ) (e error)
Create new session
func (*Provider) DestroyByToken ¶
Destroy a session by token
func (*Provider) Get ¶
func (p *Provider) Get(ctx context.Context, token string, keys []string) (vals []sessionid.Value, e error)
Get key's value from token
Click to show internal directories.
Click to hide internal directories.