Documentation ¶
Index ¶
- type MysqlProvider
- func (p *MysqlProvider) Count() (total int)
- func (p *MysqlProvider) Destroy(sid string) error
- func (p *MysqlProvider) Exist(sid string) bool
- func (p *MysqlProvider) GC()
- func (p *MysqlProvider) Init(expire int64, connStr string) (err error)
- func (p *MysqlProvider) Read(sid string) (session.RawStore, error)
- func (p *MysqlProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
- type MysqlStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MysqlProvider ¶
type MysqlProvider struct {
// contains filtered or unexported fields
}
MysqlProvider represents a mysql session provider implementation.
func (*MysqlProvider) Count ¶
func (p *MysqlProvider) Count() (total int)
Count counts and returns number of sessions.
func (*MysqlProvider) Destroy ¶
func (p *MysqlProvider) Destroy(sid string) error
Destroy deletes a session by session ID.
func (*MysqlProvider) Exist ¶
func (p *MysqlProvider) Exist(sid string) bool
Exist returns true if session with given ID exists.
func (*MysqlProvider) Init ¶
func (p *MysqlProvider) Init(expire int64, connStr string) (err error)
Init initializes mysql session provider. connStr: username:password@protocol(address)/dbname?param=value
func (*MysqlProvider) Read ¶
func (p *MysqlProvider) Read(sid string) (session.RawStore, error)
Read returns raw session store by session ID.
func (*MysqlProvider) Regenerate ¶
func (p *MysqlProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
Regenerate regenerates a session store from old session ID to new one.
type MysqlStore ¶
type MysqlStore struct {
// contains filtered or unexported fields
}
MysqlStore represents a mysql session store implementation.
func NewMysqlStore ¶
func NewMysqlStore(c *sql.DB, sid string, kv map[interface{}]interface{}) *MysqlStore
NewMysqlStore creates and returns a mysql session store.
func (*MysqlStore) Delete ¶
func (s *MysqlStore) Delete(key interface{}) error
Delete delete a key from session.
func (*MysqlStore) Get ¶
func (s *MysqlStore) Get(key interface{}) interface{}
Get gets value by given key in session.
func (*MysqlStore) Release ¶
func (s *MysqlStore) Release() error
Release releases resource and save data to provider.
func (*MysqlStore) Set ¶
func (s *MysqlStore) Set(key, val interface{}) error
Set sets value to given key in session.