summaryrefslogtreecommitdiff
path: root/pkg/database/sessions.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/database/sessions.go')
-rw-r--r--pkg/database/sessions.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/database/sessions.go b/pkg/database/sessions.go
index decba8e..43f9d50 100644
--- a/pkg/database/sessions.go
+++ b/pkg/database/sessions.go
@@ -27,6 +27,14 @@ func (db *DB) CreateSession(account *model.Account) (string, error) {
return sessionId.String(), nil
}
+func (db *DB) DeleteSession(session *model.Session) error {
+ _, err := db.Exec(`DELETE FROM sessions WHERE id = ?`, session.Id)
+ if err != nil {
+ return fmt.Errorf("failed to delete session %s: %w", session.Id, err)
+ }
+ return nil
+}
+
func (db *DB) LoadSessionById(id string) (*model.Session, error) {
session := model.Session{
Id: id,