Go Package - gin-contrib/sessions
本篇文章說明 gin-contrib/sessions 的部分函式和結構
sessions.Default
shortcut to get session
1 | session := sessions.Default(ctx) |
sessions.Session.Get
Get returns the session value associated to the given key.
1 | session.Get("isLogin") |
sessions.Session.Set
Set sets the session value associated to the given key.
1 | session.Set("isLogin", false) |
sessions.Session.Save
Save saves all sessions used during the current request.
1 | session.Save() |
cookie-based session
1 | package main |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.