Documentation ¶
Index ¶
- Variables
- func AllowCORS(w http.ResponseWriter)
- func CheckSession(ctx context.Context, userID uint32, sessionID string) error
- func CheckSessionHTTP(r io.Reader) error
- func DeleteAllExpiredSessions()
- func DeleteSessionHTTP(r io.Reader) error
- func GetSessionData(ctx context.Context, userID uint32) (string, error)
- func Login(u model.User) (model.Session, error)
- func NewLogin(w http.ResponseWriter, r *http.Request)
- func NewSession(ctx context.Context, userID uint32) (string, error)
- func Signup(u model.User) (model.Session, error)
- func StartSessionManegement()
- type SessionInf
Constants ¶
This section is empty.
Variables ¶
View Source
var SessionData map[uint32]SessionInf
Functions ¶
func AllowCORS ¶
func AllowCORS(w http.ResponseWriter)
func CheckSession ¶
CheckSession checks if session is already stored in redis database (every time)
func CheckSessionHTTP ¶
CheckSessionHTTP check session from http request and return if session is not there
func DeleteAllExpiredSessions ¶
func DeleteAllExpiredSessions()
DeleteAllExpiredSessions delete all sessions expired
func DeleteSessionHTTP ¶
HTTTP CONNECTION MOJULE DeleteSessionHTTP check session from http request and return if session is not there
func GetSessionData ¶
GetSessionData get sessionId (for CheckSession)
func Login ¶
Login user login post User{User.id, User.email, User.password} if login success return sessionID, else return "" use u1.id not u.id, because u1.id is a stored id, but u.id is a requested id.
func NewSession ¶
NewSession creates and save new session
Types ¶
type SessionInf ¶
type SessionInf struct { SessionID string `json:"session_id"` //session id Updated time.Time `json:"updated"` //last updated time }
SessionInf is a information of session linked by "userID"
Click to show internal directories.
Click to hide internal directories.