Merge pull request #14 from antonlindstrom/bugfix/column-names-underscores
Add underscores when querying column names
This commit is contained in:
commit
31a178b4b1
|
@ -53,6 +53,6 @@ func (db *PGStore) cleanup(interval time.Duration, quit <-chan struct{}, done ch
|
||||||
|
|
||||||
// deleteExpired deletes expired sessions from the database.
|
// deleteExpired deletes expired sessions from the database.
|
||||||
func (db *PGStore) deleteExpired() error {
|
func (db *PGStore) deleteExpired() error {
|
||||||
_, err := db.DbMap.Exec("DELETE FROM http_sessions WHERE expireson < now()")
|
_, err := db.DbMap.Exec("DELETE FROM http_sessions WHERE expires_on < now()")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ func TestCleanup(t *testing.T) {
|
||||||
|
|
||||||
// SELECT expired sessions. We should get a zero-length result slice back.
|
// SELECT expired sessions. We should get a zero-length result slice back.
|
||||||
var results []int64
|
var results []int64
|
||||||
_, err = ss.DbMap.Select(&results, "SELECT id FROM http_sessions WHERE expireson < now()")
|
_, err = ss.DbMap.Select(&results, "SELECT id FROM http_sessions WHERE expires_on < now()")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to select expired sessions from DB: %v", err)
|
t.Fatalf("failed to select expired sessions from DB: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ func (db *PGStore) save(session *sessions.Session) error {
|
||||||
if session.IsNew {
|
if session.IsNew {
|
||||||
err = db.DbMap.Insert(&s)
|
err = db.DbMap.Insert(&s)
|
||||||
} else {
|
} else {
|
||||||
_, err = db.DbMap.Exec("update http_sessions set data=$1, modifiedon=$2, expireson=$3 where key=$4", s.Data, s.ModifiedOn, s.ExpiresOn, s.Key)
|
_, err = db.DbMap.Exec("update http_sessions set data=$1, modified_on=$2, expires_on=$3 where key=$4", s.Data, s.ModifiedOn, s.ExpiresOn, s.Key)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue