Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemorySessionStore ¶
type MemorySessionStore struct {
// contains filtered or unexported fields
}
MemorySessionStore is a simple in-memory session store.
func (*MemorySessionStore) Del ¶
func (m *MemorySessionStore) Del(ctx context.Context, id string) error
Del deletes a session from the store.
func (*MemorySessionStore) Get ¶
func (m *MemorySessionStore) Get(ctx context.Context, id string) (SessionData, bool, error)
Get retrieves a session from the store.
func (*MemorySessionStore) Put ¶
func (m *MemorySessionStore) Put(ctx context.Context, id string, data SessionData, ttl time.Duration) error
Put stores a session in the store.
type RedisSessionStore ¶
RedisSessionStore is a session store that uses Redis.
func (*RedisSessionStore) Del ¶
func (s *RedisSessionStore) Del(ctx context.Context, id string) error
Del deletes a session from the store.
func (*RedisSessionStore) Get ¶
func (s *RedisSessionStore) Get(ctx context.Context, id string) (SessionData, bool, error)
Get retrieves a session from the store.
func (*RedisSessionStore) Put ¶
func (s *RedisSessionStore) Put(ctx context.Context, id string, data SessionData, ttl time.Duration) error
Put stores a session in the store.
type SessionData ¶
type SessionData struct {
Provider string
Subject string
Email string
Name string
AccessToken string
RefreshToken string
Expiry time.Time
CreatedAt time.Time
}
SessionData is the data stored in the session store.
type SessionStore ¶
type SessionStore interface {
Put(ctx context.Context, id string, data SessionData, ttl time.Duration) error
Get(ctx context.Context, id string) (SessionData, bool, error)
Del(ctx context.Context, id string) error
}
SessionStore is an interface for storing and retrieving sessions.
func NewMemorySessionStore ¶
func NewMemorySessionStore() SessionStore
NewMemorySessionStore creates a new MemorySessionStore.
func NewRedisSessionStore ¶
func NewRedisSessionStore(client *redis.Client, prefix string) SessionStore
NewRedisSessionStore creates a new RedisSessionStore.
Click to show internal directories.
Click to hide internal directories.