Documentation ¶
Index ¶
- Constants
- func NewEncrypt() *encrypt
- func Register(providerName string, provider Provider)
- func Version() string
- type CCMap
- func (c *CCMap) Clear()
- func (c *CCMap) Count() int
- func (c *CCMap) Delete(key string)
- func (c *CCMap) Get(key string) interface{}
- func (c *CCMap) GetAll() map[string]interface{}
- func (c *CCMap) GetOnce(key string) interface{}
- func (c *CCMap) GetSliceMap(key string) *MapSlice
- func (c *CCMap) IsExist(key string) bool
- func (c *CCMap) Keys() []string
- func (c *CCMap) MGet(keys ...string) map[string]interface{}
- func (c *CCMap) MSet(data map[string]interface{})
- func (c *CCMap) Replace(key string, value interface{})
- func (c *CCMap) Set(key string, value interface{})
- func (c *CCMap) Update(key string, value interface{})
- type Config
- type Cookie
- type MapSlice
- type Provider
- type ProviderConfig
- type Session
- func (s *Session) Destroy(ctx *fasthttp.RequestCtx)
- func (s *Session) GetSessionId(ctx *fasthttp.RequestCtx) string
- func (s *Session) Regenerate(ctx *fasthttp.RequestCtx) (sessionStore SessionStore, err error)
- func (s *Session) SetProvider(providerName string, providerConfig ProviderConfig) error
- func (s *Session) Start(ctx *fasthttp.RequestCtx) (sessionStore SessionStore, err error)
- type SessionStore
- type Store
- func (s *Store) Delete(key string)
- func (s *Store) Flush()
- func (s *Store) Get(key string) interface{}
- func (s *Store) GetAll() map[string]interface{}
- func (s *Store) GetSessionId() string
- func (s *Store) Init(sessionId string, data map[string]interface{})
- func (s *Store) Set(key string, value interface{})
Constants ¶
View Source
const (
BASE64TABLE = "1234567890poiuytreqwasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM-_"
)
Variables ¶
This section is empty.
Functions ¶
func NewEncrypt ¶
func NewEncrypt() *encrypt
Types ¶
type CCMap ¶
type CCMap struct {
// contains filtered or unexported fields
}
Concurrent Map
type Config ¶
type Config struct { // cookie name CookieName string // cookie domain Domain string // If you want to delete the cookie when the browser closes, set it to -1. // // 0 means no expire, (24 years) // -1 means when browser closes // >0 is the time.Duration which the session cookies should expire. Expires time.Duration // gc life time(s) GCLifetime int64 // session life time(s) SessionLifetime int64 // set whether to pass this bar cookie only through HTTPS Secure bool // sessionId is in url query SessionIdInURLQuery bool // sessionName in url query SessionNameInUrlQuery string // sessionId is in http header SessionIdInHttpHeader bool // sessionName in http header SessionNameInHttpHeader string // SessionIdGeneratorFunc should returns a random session id. SessionIdGeneratorFunc func() string // Encode the cookie value if not nil. EncodeFunc func(cookieValue string) (string, error) // Decode the cookie value if not nil. DecodeFunc func(cookieValue string) (string, error) }
func (*Config) SessionIdGenerator ¶
sessionId generator
type Cookie ¶
type Cookie struct { }
func (*Cookie) Delete ¶
func (c *Cookie) Delete(ctx *fasthttp.RequestCtx, name string)
delete cookie by cookie name
type Provider ¶
type Provider interface { Init(int64, ProviderConfig) error NeedGC() bool GC() ReadStore(string) (SessionStore, error) Regenerate(string, string) (SessionStore, error) Destroy(string) error Count() int }
type ProviderConfig ¶
type ProviderConfig interface {
Name() string
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session struct
func (*Session) Destroy ¶
func (s *Session) Destroy(ctx *fasthttp.RequestCtx)
destroy session in fasthttp ctx
func (*Session) GetSessionId ¶
func (s *Session) GetSessionId(ctx *fasthttp.RequestCtx) string
get session id 1. get session id by reading from cookie 2. get session id from query 3. get session id from http headers
func (*Session) Regenerate ¶
func (s *Session) Regenerate(ctx *fasthttp.RequestCtx) (sessionStore SessionStore, err error)
regenerate a session id for this SessionStore
func (*Session) SetProvider ¶
func (s *Session) SetProvider(providerName string, providerConfig ProviderConfig) error
set session provider and provider config
func (*Session) Start ¶
func (s *Session) Start(ctx *fasthttp.RequestCtx) (sessionStore SessionStore, err error)
session start 1. get sessionId from fasthttp ctx 2. if sessionId is empty, generator sessionId and set response Set-Cookie 3. return session provider store
type SessionStore ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.