GetSession returns session object of specified session id.
(db *gorp.DbMap, id string)
| 300 | |
| 301 | // GetSession returns session object of specified session id. |
| 302 | func GetSession(db *gorp.DbMap, id string) (s *Session, err error) { |
| 303 | err = db.SelectOne(&s, |
| 304 | `SELECT * FROM "session" WHERE "id" = ? LIMIT 1`, id) |
| 305 | if err != nil { |
| 306 | err = errors.Wrapf(err, "get session failed") |
| 307 | return |
| 308 | } |
| 309 | err = s.Deserialize() |
| 310 | if err != nil { |
| 311 | err = errors.Wrapf(err, "decode session failed") |
| 312 | return |
| 313 | } |
| 314 | |
| 315 | return |
| 316 | } |
| 317 | |
| 318 | // SaveSession saves session object to database. |
| 319 | func SaveSession(db *gorp.DbMap, s *Session, expire int64) (r *Session, err error) { |
no test coverage detected