feat(session): support v1

support v1
This commit is contained in:
Alan Xu
2024-08-03 22:57:53 +08:00
committed by Ming Deng
parent 3c6986a5c4
commit 17e916f4a0
14 changed files with 349 additions and 68 deletions

View File

@@ -19,6 +19,7 @@
// go install github.com/go-sql-driver/mysql
//
// mysql session support need create table as sql:
//
// CREATE TABLE `session` (
// `session_key` char(64) NOT NULL,
// `session_data` blob,
@@ -28,8 +29,10 @@
//
// Usage:
// import(
// _ "github.com/beego/beego/session/mysql"
// "github.com/beego/beego/session"
//
// _ "github.com/beego/beego/session/mysql"
// "github.com/beego/beego/session"
//
// )
//
// func init() {
@@ -117,6 +120,11 @@ func (st *SessionStore) SessionRelease(w http.ResponseWriter) {
b, time.Now().Unix(), st.sid)
}
// SessionReleaseIfPresent save mysql session values to database.
func (st *SessionStore) SessionReleaseIfPresent(w http.ResponseWriter) {
st.SessionRelease(w)
}
// Provider mysql session provider
type Provider struct {
maxlifetime int64