Documentation ¶
Index ¶
- Variables
- func Signin(user encoder, w http.ResponseWriter) error
- func Signout(w http.ResponseWriter)
- type User
- func (u *User) Decode(s string) (err error)
- func (u User) Encode() (s string, err error)
- func (u *User) IsExpired() bool
- func (z *User) MarshalMsg(b []byte) (o []byte, err error)
- func (z *User) Msgsize() (s int)
- func (u *User) NeedRefresh() bool
- func (u *User) Refresh()
- func (user *User) Signin(w http.ResponseWriter) error
- func (z *User) UnmarshalMsg(bts []byte) (o []byte, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CookieName = "_user" CookiePath = "/" CookieMaxAge = 3600 )
View Source
var ( UserLifetime int64 = 3600 Guest = &User{} )
Functions ¶
func Signin ¶
func Signin(user encoder, w http.ResponseWriter) error
Signin write user encoded string into cookie
Types ¶
type User ¶
type User struct { UID string `json:"uid" msg:"u"` Name string `json:"name" msg:"n"` Privileges string `json:"privileges,omitempty" msg:"p"` LastHit int64 `json:"hit,omitempty" msg:"h"` TeamID int `json:"tid,omitempty" msg:"t"` }
User 在线用户
func UserFromRequest ¶
UserFromRequest get user from cookie
func (*User) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*User) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*User) NeedRefresh ¶
Click to show internal directories.
Click to hide internal directories.