Versions in this module Expand all Collapse all v12 v12.1.9 Aug 12, 2022 Changes in this version + const DefaultCookieName + var CookieExpireDelete = time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) + var CookieExpireUnlimited = time.Now().AddDate(24, 10, 10) + var ErrNotFound = errors.New("session not found") + var ErrNotImplemented = errors.New("not implemented yet") + func AddCookie(ctx context.Context, cookie *http.Cookie, reclaim bool) + func GetCookie(ctx context.Context, name string) string + func IsValidCookieDomain(domain string) bool + func RemoveCookie(ctx context.Context, config Config) + type Config struct + AllowReclaim bool + Cookie string + CookieSecureTLS bool + Decode func(cookieName string, cookieValue string, v interface{}) error + DisableSubdomainPersistence bool + Encode func(cookieName string, value interface{}) (string, error) + Encoding Encoding + Expires time.Duration + SessionIDGenerator func(ctx context.Context) string + func (c Config) Validate() Config + type Database interface + Acquire func(sid string, expires time.Duration) LifeTime + Clear func(sid string) + Delete func(sid string, key string) (deleted bool) + Get func(sid string, key string) interface{} + Len func(sid string) int + OnUpdateExpiration func(sid string, newExpires time.Duration) error + Release func(sid string) + Set func(sid string, lifetime LifeTime, key string, value interface{}, immutable bool) + Visit func(sid string, cb func(key string, value interface{})) + type DestroyListener func(sid string) + type Encoding interface + Decode func(cookieName string, cookieValue string, v interface{}) error + Encode func(cookieName string, value interface{}) (string, error) + type ErrEntryNotFound struct + Err *memstore.ErrEntryNotFound + Value interface{} + func (e *ErrEntryNotFound) As(target interface{}) bool + func (e *ErrEntryNotFound) Error() string + func (e *ErrEntryNotFound) Unwrap() error + type LifeTime struct + func (lt *LifeTime) Begin(d time.Duration, onExpire func()) + func (lt *LifeTime) DurationUntilExpiration() time.Duration + func (lt *LifeTime) ExpireNow() + func (lt *LifeTime) HasExpired() bool + func (lt *LifeTime) Revive(onExpire func()) + func (lt *LifeTime) Shift(d time.Duration) + type Marshaler interface + Marshal func(interface{}) ([]byte, error) + type Session struct + Lifetime LifeTime + func Get(ctx context.Context) *Session + func (s *Session) Clear() + func (s *Session) ClearFlashes() + func (s *Session) Decrement(key string, n int) (newValue int) + func (s *Session) Delete(key string) bool + func (s *Session) DeleteFlash(key string) + func (s *Session) Destroy() + func (s *Session) Get(key string) interface{} + func (s *Session) GetAll() map[string]interface{} + func (s *Session) GetBoolean(key string) (bool, error) + func (s *Session) GetBooleanDefault(key string, defaultValue bool) bool + func (s *Session) GetFlash(key string) interface{} + func (s *Session) GetFlashString(key string) string + func (s *Session) GetFlashStringDefault(key string, defaultValue string) string + func (s *Session) GetFlashes() map[string]interface{} + func (s *Session) GetFloat32(key string) (float32, error) + func (s *Session) GetFloat32Default(key string, defaultValue float32) float32 + func (s *Session) GetFloat64(key string) (float64, error) + func (s *Session) GetFloat64Default(key string, defaultValue float64) float64 + func (s *Session) GetInt(key string) (int, error) + func (s *Session) GetInt64(key string) (int64, error) + func (s *Session) GetInt64Default(key string, defaultValue int64) int64 + func (s *Session) GetIntDefault(key string, defaultValue int) int + func (s *Session) GetString(key string) string + func (s *Session) GetStringDefault(key string, defaultValue string) string + func (s *Session) HasFlash() bool + func (s *Session) ID() string + func (s *Session) Increment(key string, n int) (newValue int) + func (s *Session) IsNew() bool + func (s *Session) Len() int + func (s *Session) PeekFlash(key string) interface{} + func (s *Session) Set(key string, value interface{}) + func (s *Session) SetFlash(key string, value interface{}) + func (s *Session) SetImmutable(key string, value interface{}) + func (s *Session) Visit(cb func(k string, v interface{})) + type Sessions struct + func New(cfg Config) *Sessions + func (s *Sessions) Destroy(ctx context.Context) + func (s *Sessions) DestroyAll() + func (s *Sessions) DestroyByID(sid string) + func (s *Sessions) Handler(cookieOptions ...context.CookieOption) context.Handler + func (s *Sessions) OnDestroy(listeners ...DestroyListener) + func (s *Sessions) ShiftExpiration(ctx context.Context, cookieOptions ...context.CookieOption) error + func (s *Sessions) Start(ctx context.Context, cookieOptions ...context.CookieOption) *Session + func (s *Sessions) StartWithPath(ctx context.Context, path string) *Session + func (s *Sessions) UpdateExpiration(ctx context.Context, expires time.Duration, ...) error + func (s *Sessions) UseDatabase(db Database) + type Transcoder interface + var DefaultTranscoder Transcoder = defaultTranscoder{} + type Unmarshaler interface + Unmarshal func([]byte, interface{}) error