session

package
v0.76.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package session contains methods and objects for managing user sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(ctx context.Context) error

Clear deletes the session data from the session store and sets the session status to Destroyed. Any further operations in the same request cycle will result in a new session being created.

func LoadAndSave

func LoadAndSave(next http.Handler) http.Handler

LoadAndSave middleware handles loading the session data for a request and saving any modifications.

func NewSessionManager

func NewSessionManager() error

NewSessionManager creates a new session manager.

func Renew added in v0.51.0

func Renew(ctx context.Context) error

Renew updates the session data to have a new session token while retaining the current session data. The session lifetime is also reset and the session data status will be set to Modified. The old session token and accompanying data are deleted from the session store.

func Restore

func Restore[T any](ctx context.Context, key string) (T, error)

Restore retrieves an object from the session storage with the given key. If the object cannot be retrieved, then the defaultFunc is used to generate a new default value.

func Save

func Save[T any](ctx context.Context, key string, obj T)

Save saves the given object to the session storage with the given key.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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