session

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SessionIDKey = "session-id"

Replace this variable to change the key

Functions

This section is empty.

Types

type CookieStore

type CookieStore[T any] struct {
	// contains filtered or unexported fields
}

func NewCookieStore

func NewCookieStore[T any](authenticationKey, encryptionKey []byte) *CookieStore[T]

func (*CookieStore[T]) Load

func (store *CookieStore[T]) Load(ctx context.Context, session *Session) (*T, error)

func (*CookieStore[T]) Save

func (store *CookieStore[T]) Save(ctx context.Context, session *Session, t *T) error

type Manager

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

func NewManager

func NewManager(path string, maxAge int) *Manager

func (Manager) Get

func (manager Manager) Get(r *http.Request) (*Session, error)

func (Manager) Save

func (manager Manager) Save(w http.ResponseWriter, session *Session)

type Session

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

func (Session) ID

func (s Session) ID() string

func (*Session) SetID

func (s *Session) SetID(id string)

type Store

type Store[T any] interface {
	Load(ctx context.Context, id *Session) (*T, error)
	Save(ctx context.Context, id *Session, t *T) error
}

Jump to

Keyboard shortcuts

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