session

package
v0.0.0-...-dbec4ac Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Username   = "username"
	WorkingDir = "wd"
)

Variables

This section is empty.

Functions

func Register

func Register(name string, provider Provider)

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}
var SessionManager *Manager

func NewManager

func NewManager(providerName string, cookieName string, maxLifetime int) (*Manager, error)

func (*Manager) GC

func (manager *Manager) GC()

func (*Manager) SessionEnd

func (manager *Manager) SessionEnd(w http.ResponseWriter, r *http.Request) error

func (*Manager) SessionExists

func (manager *Manager) SessionExists(w http.ResponseWriter, r *http.Request) bool

func (*Manager) SessionStart

func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (session Session)

type Provider

type Provider interface {
	SessionInit(sid string) (Session, error)
	SessionRead(sid string) (Session, error)
	SessionDestroy(sid string) error
	SessionGC(maxLifetime int)
}

type Session

type Session interface {
	Set(key, value interface{}) error
	Get(key interface{}) interface{}
	Delete(key interface{}) error
	SessionID() string
}

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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