Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
d8e1f31c
Commit
d8e1f31c
authored
May 13, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update session's key from string to interface
parent
719f94b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
controller.go
controller.go
+3
-3
sess_file.go
session/sess_file.go
+6
-4
sess_mysql.go
session/sess_mysql.go
+6
-4
No files found.
controller.go
View file @
d8e1f31c
...
...
@@ -275,21 +275,21 @@ func (c *Controller) StartSession() session.SessionStore {
return
c
.
CruSession
}
func
(
c
*
Controller
)
SetSession
(
name
string
,
value
interface
{})
{
func
(
c
*
Controller
)
SetSession
(
name
interface
{}
,
value
interface
{})
{
if
c
.
CruSession
==
nil
{
c
.
StartSession
()
}
c
.
CruSession
.
Set
(
name
,
value
)
}
func
(
c
*
Controller
)
GetSession
(
name
string
)
interface
{}
{
func
(
c
*
Controller
)
GetSession
(
name
interface
{}
)
interface
{}
{
if
c
.
CruSession
==
nil
{
c
.
StartSession
()
}
return
c
.
CruSession
.
Get
(
name
)
}
func
(
c
*
Controller
)
DelSession
(
name
string
)
{
func
(
c
*
Controller
)
DelSession
(
name
interface
{}
)
{
if
c
.
CruSession
==
nil
{
c
.
StartSession
()
}
...
...
session/sess_file.go
View file @
d8e1f31c
...
...
@@ -58,11 +58,13 @@ func (fs *FileSessionStore) SessionRelease() {
}
func
(
fs
*
FileSessionStore
)
updatecontent
()
{
b
,
err
:=
encodeGob
(
fs
.
values
)
if
err
!=
nil
{
return
if
len
(
fs
.
values
)
>
0
{
b
,
err
:=
encodeGob
(
fs
.
values
)
if
err
!=
nil
{
return
}
fs
.
f
.
Write
(
b
)
}
fs
.
f
.
Write
(
b
)
}
type
FileProvider
struct
{
...
...
session/sess_mysql.go
View file @
d8e1f31c
...
...
@@ -55,11 +55,13 @@ func (st *MysqlSessionStore) SessionID() string {
}
func
(
st
*
MysqlSessionStore
)
updatemysql
()
{
b
,
err
:=
encodeGob
(
st
.
values
)
if
err
!=
nil
{
return
if
len
(
st
.
values
)
>
0
{
b
,
err
:=
encodeGob
(
st
.
values
)
if
err
!=
nil
{
return
}
st
.
c
.
Exec
(
"UPDATE session set `session_data`= ? where session_key=?"
,
b
,
st
.
sid
)
}
st
.
c
.
Exec
(
"UPDATE session set `session_data`= ? where session_key=?"
,
b
,
st
.
sid
)
}
func
(
st
*
MysqlSessionStore
)
SessionRelease
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment