session

package
v0.0.0-...-9816518 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CookieDomain   = "domain"
	CookieExpires  = "expires"
	CookieHttpOnly = "http-only"
	CookieMaxAge   = "max-age"
	CookiePath     = "path"
	CookieSecure   = "secure"
)

Variables

View Source
var CleanCookieOptions = M{
	CookieExpires: time.Now(),
	CookieMaxAge:  0,
}
View Source
var DefaultCookieOptions = M{
	CookieDomain:   "",
	CookieHttpOnly: false,
	CookieMaxAge:   3600,
	CookiePath:     "/",
	CookieSecure:   false,
}

Functions

func GetKey

func GetKey() []byte

func SetKey

func SetKey(key []byte)

Types

type FactoryFunc

type FactoryFunc func(http.ResponseWriter, *http.Request) (*Session, error)

func NewFactory

func NewFactory(storage Storage) FactoryFunc

type M

type M map[string]interface{}

type Session

type Session struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Session) Clean

func (s *Session) Clean() error

func (*Session) Del

func (s *Session) Del(key string) (value interface{})

func (*Session) Flush

func (s *Session) Flush() error

func (*Session) Get

func (s *Session) Get(key string) (value interface{})

func (*Session) Id

func (s *Session) Id() string

func (*Session) Init

func (s *Session) Init() error

func (*Session) Set

func (s *Session) Set(key string, value interface{})

type Storage

type Storage interface {
	Clean(*Session) error
	Flush(*Session) error
	LoadTo(*http.Request, *Session) error
}

func CookieStorage

func CookieStorage(keyName string, options M) Storage

Jump to

Keyboard shortcuts

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