You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
532 B
23 lines
532 B
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// The Session model represents a user being logged in.
|
|
type Session struct {
|
|
ID string
|
|
UserID int
|
|
Expires time.Time
|
|
}
|
|
|
|
// SessionRepository is an interface for all database operations
|
|
// the user model makes.
|
|
type SessionRepository interface {
|
|
// FindSessionByID finds a non-expired session by ID.
|
|
FindSessionByID(id int) (Session, error)
|
|
InsertSession(session Session) error
|
|
RemoveSession(session Session) error
|
|
ClearUserSessions(user User) error
|
|
RemoveExpiredSessions() error
|
|
}
|