summaryrefslogtreecommitdiff
path: root/db/session.go
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-05-02 14:20:21 -0500
committersanine-a <sanine.not@pm.me>2023-05-02 14:20:21 -0500
commitad6a617c12d9b341be1357dcbb6ab58febe32ee8 (patch)
tree08fb50ad9ddc17c911ae175c2a62a463d67160de /db/session.go
parente365e8c2fd4e3a595c696849734236008fc67e1f (diff)
add TouchSession
Diffstat (limited to 'db/session.go')
-rw-r--r--db/session.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/db/session.go b/db/session.go
index bddedda..b8365ff 100644
--- a/db/session.go
+++ b/db/session.go
@@ -73,6 +73,14 @@ func extractSession(s Scanner) (Session, error) {
}
+func (p *Phlox) TouchSession(session Session) error {
+ now := time.Now().UTC()
+ nowStr := now.Format(time.RFC3339)
+ _, err := p.db.Exec("update sessions set modified=? where sessionid=?;", nowStr, session.Id)
+ return err
+}
+
+
func (p *Phlox) CheckSession(session Session) (bool, error) {
row := p.db.QueryRow("select * from sessions where sessionid = ?", session.Id)
session, err := extractSession(row)
@@ -96,7 +104,7 @@ func (p *Phlox) TouchSession(session Session) error {
"update sessions set modified = ? where sessionid = ?;",
now, session.Id,
)
- return err
+ return err
}