Documentation ¶
Index ¶
- Variables
- type Cookie
- type Data
- type Key
- type Session
- func (s *Session) Create(key string)
- func (z *Session) DecodeMsg(dc *msgp.Reader) (err error)
- func (s *Session) Delete()
- func (z *Session) EncodeMsg(en *msgp.Writer) (err error)
- func (s *Session) Get(key string) (interface{}, error)
- func (s *Session) GetBytes(key string) ([]byte, error)
- func (s *Session) Init(store *Store)
- func (z *Session) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Session) Msgsize() (s int)
- func (s *Session) Regenerate()
- func (s *Session) Set(key string, value interface{}) error
- func (z *Session) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (s *Session) Updated()
- type Status
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNilKey returned when key has 0 or less length ErrNilKey = errors.New("Session: Error 0 length key") // ErrNilValue returned when value is nil ErrNilValue = errors.New("Session: Error nil value") // ErrValueType returned when value type is invalid ErrValueType = errors.New("Session: Error invalid value type") )
View Source
var ErrNoSession = errors.New("Error No Session")
ErrNoSession returned by Data Get on no session found
Functions ¶
This section is empty.
Types ¶
type Cookie ¶
type Cookie struct { // Name of Cookie NOT Value Name string Domain string Path string Secure bool HTTPOnly bool SameSite string }
Cookie struct
type Data ¶
type Data interface { // Returns session, error Get(key string) (*Session, error) Set(session *Session) error Delete(key string) error }
Data interface of storage of session
type Key ¶
type Key struct { // Length is passed to generator // Min/default value of 16 Length int // Generator generates session id Generator func(int) string }
Key struct
type Session ¶
type Session struct { // Created time.Time Created time.Time `msg:"created"` // Expires time.Time Expires time.Time `msg:"expires"` // Status of session Status Status `msg:"status"` // Key session identifier Key string `msg:"key"` // Data of session Data map[string]interface{} `msg:"data"` // contains filtered or unexported fields }
Session is session
func (*Session) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Session) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*Session) UnmarshalMsg ¶
UnmarshalMsg implements msgp.Unmarshaler
type Status ¶
type Status int8
Status of Session
func (Status) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Store ¶
type Store struct { // MaxLife of session since creation MaxLife time.Duration // Expiration max time session can go unused Expiration time.Duration // Session Cookie Cookie Cookie // Data interface for interacting with session store db Data Data // Key struct (Length, Generator) Key Key }
Store session storage
Click to show internal directories.
Click to hide internal directories.