diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2018-12-30 06:34:30 -0500 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2018-12-30 06:34:30 -0500 |
| commit | 9c959b259c25a591be9ae26caac0a0a4467f7720 (patch) | |
| tree | 7fd8f1fc45817a5aa8766e10ea37e12e015d0c04 /store.go | |
| parent | 1ed8283df70c5c2f597821fd318cbda89d2eb7ea (diff) | |
| download | id-9c959b259c25a591be9ae26caac0a0a4467f7720.tar.gz | |
Improve logout
Diffstat (limited to 'store.go')
| -rw-r--r-- | store.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -24,6 +24,7 @@ type Store interface { GetSession(id string) (*Session, bool) NewSession(userId int64) *Session GetUser(name string) (*User, bool) + DeleteSession(id string) } type PgStore struct { @@ -66,6 +67,11 @@ func (store *PgStore) NewSession(userId int64) *Session { return s } +func (store *PgStore) DeleteSession(id string) { + store.Query("DELETE FROM sessions WHERE id = $1", id) + delete(store.sessionCache, id) +} + func (store *PgStore) GetUser(name string) (*User, bool) { u := &User{Name: name} row := store.QueryRow( |
