Documentation
¶
Index ¶
Constants ¶
View Source
const Version = "1.0.0"
Version is this package's version
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CookieStore ¶
type CookieStore struct {
// contains filtered or unexported fields
}
CookieStore stores sessions using secure cookies.
func (*CookieStore) Destroy ¶ added in v1.1.0
func (c *CookieStore) Destroy(session Sessions) (err error)
Destroy destroy the session
func (*CookieStore) Save ¶
func (c *CookieStore) Save(session Sessions) (err error)
Save session to Response's cookie
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore using memory to store sessions base on secure cookies.
func NewMemoryStore ¶
func NewMemoryStore(options ...*Options) (store *MemoryStore)
NewMemoryStore returns an MemoryStore instance
func (*MemoryStore) Close ¶ added in v1.1.0
func (m *MemoryStore) Close()
Close goroutine cleanCache thread
func (*MemoryStore) Destroy ¶
func (m *MemoryStore) Destroy(session Sessions) (err error)
Destroy destroy the session
func (*MemoryStore) Save ¶
func (m *MemoryStore) Save(session Sessions) (err error)
Save session to Response's cookie
type Meta ¶
type Meta struct {
// contains filtered or unexported fields
}
Meta stores the values and optional configuration for a session.
type Options ¶
Options stores configuration for a session or session store.
Fields are a subset of http.Cookie fields.
type Sessions ¶
type Sessions interface {
// Init sets current cookie.Cookies and Store to the session instance.
Init(name, sid string, c *cookie.Cookies, store Store, lastValue string)
// GetSID returns the session' sid
GetSID() string
// GetName returns the session' name
GetName() string
// GetStore returns the session' store
GetStore() Store
// GetCookie returns the session' cookie
GetCookie() *cookie.Cookies
// IsChanged to check current session's value whether is changed
IsChanged(val string) bool
// IsNew to check the current session whether it's new user
IsNew() bool
}
Sessions ...
type Store ¶
type Store interface {
// Load should load data from cookie and store, set it into session instance.
// error indicates that session validation failed, or other thing.
// Sessions.Init should be called in Load, even if error occured.
Load(name string, session Sessions, cookie *cookie.Cookies) error
// Save should persist session to the underlying store implementation.
Save(session Sessions) error
// Destroy should destroy the session.
Destroy(session Sessions) error
}
Store is an interface for custom session stores.
Click to show internal directories.
Click to hide internal directories.