Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to solve this err :gob: type not registered for interface: components.UserInfoInSession #191

Open
minutel163 opened this issue Sep 8, 2022 · 1 comment

Comments

@minutel163
Copy link

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 ?

@gh-nom
Copy link

gh-nom commented Sep 14, 2022

Maybe this will help you. for NewStore befor. look at this references

import "encoding/gob"

gob.Register(UserInfoInSession{})

end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants