Documentation ¶
Overview ¶
SessionOn = true SessionProvider = postgresql SessionSavePath = "user=a password=b dbname=c sslmode=disable" SessionName = session
Usage: import(
_ "github.com/aamsur/beego/session/postgresql" "github.com/aamsur/beego/session"
)
func init() { globalSessions, _ = session.NewManager("postgresql", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"user=pqgotest dbname=pqgotest sslmode=verify-full"}``) go globalSessions.GC() }
more docs: http://beego.me/docs/module/session.md
Index ¶
- type PostgresqlProvider
- func (mp *PostgresqlProvider) SessionAll() int
- func (mp *PostgresqlProvider) SessionDestroy(sid string) error
- func (mp *PostgresqlProvider) SessionExist(sid string) bool
- func (mp *PostgresqlProvider) SessionGC()
- func (mp *PostgresqlProvider) SessionInit(maxlifetime int64, savePath string) error
- func (mp *PostgresqlProvider) SessionRead(sid string) (session.SessionStore, error)
- func (mp *PostgresqlProvider) SessionRegenerate(oldsid, sid string) (session.SessionStore, error)
- type PostgresqlSessionStore
- func (st *PostgresqlSessionStore) Delete(key interface{}) error
- func (st *PostgresqlSessionStore) Flush() error
- func (st *PostgresqlSessionStore) Get(key interface{}) interface{}
- func (st *PostgresqlSessionStore) SessionID() string
- func (st *PostgresqlSessionStore) SessionRelease(w http.ResponseWriter)
- func (st *PostgresqlSessionStore) Set(key, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresqlProvider ¶
type PostgresqlProvider struct {
// contains filtered or unexported fields
}
postgresql session provider
func (*PostgresqlProvider) SessionAll ¶
func (mp *PostgresqlProvider) SessionAll() int
count values in postgresql session
func (*PostgresqlProvider) SessionDestroy ¶
func (mp *PostgresqlProvider) SessionDestroy(sid string) error
delete postgresql session by sid
func (*PostgresqlProvider) SessionExist ¶
func (mp *PostgresqlProvider) SessionExist(sid string) bool
check postgresql session exist
func (*PostgresqlProvider) SessionGC ¶
func (mp *PostgresqlProvider) SessionGC()
delete expired values in postgresql session
func (*PostgresqlProvider) SessionInit ¶
func (mp *PostgresqlProvider) SessionInit(maxlifetime int64, savePath string) error
init postgresql session. savepath is the connection string of postgresql.
func (*PostgresqlProvider) SessionRead ¶
func (mp *PostgresqlProvider) SessionRead(sid string) (session.SessionStore, error)
get postgresql session by sid
func (*PostgresqlProvider) SessionRegenerate ¶
func (mp *PostgresqlProvider) SessionRegenerate(oldsid, sid string) (session.SessionStore, error)
generate new sid for postgresql session
type PostgresqlSessionStore ¶
type PostgresqlSessionStore struct {
// contains filtered or unexported fields
}
postgresql session store
func (*PostgresqlSessionStore) Delete ¶
func (st *PostgresqlSessionStore) Delete(key interface{}) error
delete value in postgresql session
func (*PostgresqlSessionStore) Flush ¶
func (st *PostgresqlSessionStore) Flush() error
clear all values in postgresql session
func (*PostgresqlSessionStore) Get ¶
func (st *PostgresqlSessionStore) Get(key interface{}) interface{}
get value from postgresql session
func (*PostgresqlSessionStore) SessionID ¶
func (st *PostgresqlSessionStore) SessionID() string
get session id of this postgresql session store
func (*PostgresqlSessionStore) SessionRelease ¶
func (st *PostgresqlSessionStore) SessionRelease(w http.ResponseWriter)
save postgresql session values to database. must call this method to save values to database.
func (*PostgresqlSessionStore) Set ¶
func (st *PostgresqlSessionStore) Set(key, value interface{}) error
set value in postgresql session. it is temp value in map.