You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I defined a struce like this:
type UserInfoInSession struct {
Uid uint64 json:"uid"
Address string json:"address"
}
then use the session/redis like this
userInfo := components.UserInfoInSession{
Uid: account.Uid,
Address: account.Address,
}
session := sessions.Default(ctx)
session.Set(sessionKey, userBasicInfo)
err := session.Save()
here throw a err :"gob: type not registered for interface: components.UserInfoInSession"
I found gob need to call a register func: gob.Register
Temply I use a json string instand,but how can I use the struct ?
The text was updated successfully, but these errors were encountered:
I defined a struce like this:
type UserInfoInSession struct {
Uid uint64
json:"uid"
Address string
json:"address"
}
then use the session/redis like this
userInfo := components.UserInfoInSession{
Uid: account.Uid,
Address: account.Address,
}
session := sessions.Default(ctx)
session.Set(sessionKey, userBasicInfo)
err := session.Save()
here throw a err :"gob: type not registered for interface: components.UserInfoInSession"
I found gob need to call a register func: gob.Register
Temply I use a json string instand,but how can I use the struct ?
The text was updated successfully, but these errors were encountered: