session

package
v0.0.0-...-3bb7120 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(options ...Option) *Manager

func (*Manager) Destroy

func (m *Manager) Destroy(ctx context.Context) error

func (*Manager) Get

func (m *Manager) Get(ctx context.Context, key string) interface{}

func (*Manager) GetExpiry

func (m *Manager) GetExpiry(ctx context.Context) time.Time

func (*Manager) LoadAndSave

func (m *Manager) LoadAndSave(next http.Handler) http.Handler

func (*Manager) LoadAndSaveGuest

func (m *Manager) LoadAndSaveGuest(next http.Handler) http.Handler

func (*Manager) LoadUser

func (m *Manager) LoadUser(next http.Handler) http.Handler

func (*Manager) Put

func (m *Manager) Put(ctx context.Context, key string, value interface{})

func (*Manager) Remove

func (m *Manager) Remove(ctx context.Context, key string)

func (*Manager) SetAuthUser

func (m *Manager) SetAuthUser(ctx context.Context, u session.User) error

type MessagePackCodec

type MessagePackCodec struct{}

func (MessagePackCodec) Decode

func (MessagePackCodec) Decode(b []byte) (deadline time.Time, values map[string]interface{}, error error)

func (MessagePackCodec) Encode

func (MessagePackCodec) Encode(deadline time.Time, values map[string]interface{}) ([]byte, error)

type Option

type Option func(*Manager)

func WithAuthLifetime

func WithAuthLifetime(d time.Duration) Option

func WithCodec

func WithCodec(codec scs.Codec) Option

func WithCookieName

func WithCookieName(name string) Option

func WithGuestLifetime

func WithGuestLifetime(d time.Duration) Option

func WithGuestSkipPaths

func WithGuestSkipPaths(paths map[string][]string) Option

func WithStore

func WithStore(store scs.Store) Option

type RedisStore

type RedisStore struct {
	// contains filtered or unexported fields
}

func NewRedisStore

func NewRedisStore(client *redis.Client) *RedisStore

func (*RedisStore) All

func (s *RedisStore) All() (map[string][]byte, error)

func (*RedisStore) AllCtx

func (s *RedisStore) AllCtx(ctx context.Context) (map[string][]byte, error)

func (*RedisStore) Commit

func (s *RedisStore) Commit(token string, b []byte, expiry time.Time) error

func (*RedisStore) CommitCtx

func (s *RedisStore) CommitCtx(ctx context.Context, token string, b []byte, expiry time.Time) error

func (*RedisStore) Delete

func (s *RedisStore) Delete(token string) (err error)

func (*RedisStore) DeleteCtx

func (s *RedisStore) DeleteCtx(ctx context.Context, token string) (err error)

func (*RedisStore) Find

func (s *RedisStore) Find(token string) (b []byte, exists bool, err error)

func (*RedisStore) FindCtx

func (s *RedisStore) FindCtx(ctx context.Context, token string) (b []byte, exists bool, err error)

func (*RedisStore) WithPrefix

func (s *RedisStore) WithPrefix(prefix string) *RedisStore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL