session

package
v0.0.0-...-3655715 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CookieName = "sid"

Variables

View Source
var (
	ErrNoSession = errNs.NewType("no_session").New("session not found")
)

Functions

func Middleware

func Middleware(
	store Store,
) func(next http.Handler) http.Handler

func RemoveSIDCookie

func RemoveSIDCookie(w http.ResponseWriter, secure bool)

func ResetSession

func ResetSession(r *http.Request, w http.ResponseWriter)

func WriteSIDCookie

func WriteSIDCookie(w http.ResponseWriter, sid string, expiration time.Duration, secure bool)

Types

type Session

type Session interface {
	Get(key string) (string, bool)
	Put(key string, value string)
	Save(ctx context.Context) error
	ID() string
}

func Get

func Get(r *http.Request) (Session, bool)

type Store

type Store interface {
	Get(ctx context.Context, id string) (Session, error)
}

func NewRedisStore

func NewRedisStore(client *redis.Client) Store

Jump to

Keyboard shortcuts

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