sessionstorage

package
v0.0.0-...-1bbc35f Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryDatabaseParams

type InMemoryDatabaseParams struct {
	Sessions map[string]*model.Session
}

type SessionStorage

type SessionStorage interface {
	// AddSession adds a new session to the storage.
	AddSession(ctx context.Context, session *model.Session) (err error)
	// GetSession retrieves a session from the storage using the JWT ID.
	GetSession(ctx context.Context, jwtID string) (session *model.Session, err error)
	// ReplaceSession replaces an old session with a new session in the storage.
	ReplaceSession(ctx context.Context, oldSession *model.Session, session *model.Session) (err error)
	// DeleteSession deletes a session from the storage.
	DeleteSession(ctx context.Context, jwtID string) (err error)
}

SessionStorage is an interface that declares methods for session management in a database.

func NewInMemoryDatabase

func NewInMemoryDatabase(params *InMemoryDatabaseParams) SessionStorage

func NewRedisDatabase

func NewRedisDatabase(logger *zap.SugaredLogger, redis *redis.Client) SessionStorage

NewRedisDatabase is a constructor for sessionstorage.

Jump to

Keyboard shortcuts

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