Documentation ¶
Index ¶
- Variables
- func GetDomain(host string) string
- func GetIP(r *http.Request) string
- func Init()
- func NewUserSession(resource *crud.Resource, uid string, r *http.Request, w http.ResponseWriter) string
- func RemoveUserSession(resource *crud.Resource, r *http.Request)
- func SaveSessionId(r *http.Request, w http.ResponseWriter) *http.Cookie
- func SetUserSession(r *http.Request, session *UserSession)
- func WrapUserSession(resource *crud.Resource, r *http.Request)
- type UserSession
Constants ¶
This section is empty.
Variables ¶
View Source
var MaxAge int
View Source
var SidKey = "sid"
Functions ¶
func NewUserSession ¶
func RemoveUserSession ¶ added in v1.0.9
func SaveSessionId ¶
func SetUserSession ¶ added in v1.0.9
func SetUserSession(r *http.Request, session *UserSession)
Types ¶
type UserSession ¶
type UserSession struct { base.BaseId `bson,inline` Uid *primitive.ObjectID `bson:"uid" json:"uid"` Expires *time.Time `bson:"expires,omitempty" json:"expires,omitempty"` Agent string `bson:"agent,omitempty" json:"agent,omitempty"` Ip string `bson:"ip,omitempty" json:"ip,omitempty"` Status string `bson:"status" json:"status"` }
用户session模型
func (*UserSession) GetUid ¶ added in v1.0.9
func (u *UserSession) GetUid() string
Click to show internal directories.
Click to hide internal directories.