Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct { UserID int // Our User ID GitHubID int // User's GitHub ID GitHubOAuthState uuid.UUID // State/CSRF token when using GitHub OAuth flow // contains filtered or unexported fields }
Session represents a user's session and contains all their data. This is marshalled into a []byte storage using json, so some restrictions such as only exported members are saved apply.
func FromContext ¶
FromContext returns the session from a context.
func GetOrCreate ¶
GetOrCreate reads the http.Request looking for a session ID and attempts to load this sesstion from the database. Most errors are handled by creating a new session. Call Save() on the session to persist to db.
func (*Session) Delete ¶
func (s *Session) Delete(w http.ResponseWriter) error
Delete deletes the user's sessions from the database and sets the cookie to expire.
Click to show internal directories.
Click to hide internal directories.