aboutsummaryrefslogtreecommitdiffstats
path: root/store.go
diff options
context:
space:
mode:
Diffstat (limited to 'store.go')
-rw-r--r--store.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/store.go b/store.go
index 9a28840..1f0ca76 100644
--- a/store.go
+++ b/store.go
@@ -14,7 +14,7 @@ type Session struct {
type User struct {
Id int64
- UserName string
+ Name string
Password []byte
}
@@ -43,7 +43,7 @@ func (store *PgStore) GetSession(id string) (*Session, bool) {
}
s = new(Session)
row := store.QueryRow("SELECT id, user_id FROM session WHERE id = $1", id)
- if err := row.Scan(s.Id, s.UserId); err != nil {
+ if err := row.Scan(&s.Id, &s.UserId); err != nil {
return nil, false
}
store.sessionCache[s.Id] = s
@@ -51,9 +51,9 @@ func (store *PgStore) GetSession(id string) (*Session, bool) {
}
func (store *PgStore) GetUser(name string) (*User, bool) {
- u := new(User)
- row := store.QueryRow("SELECT id, user_name, password FROM user WHERE user_name = $1", name)
- if err := row.Scan(u.Id, u.UserName, u.Password); err != nil {
+ u := &User{Name: name}
+ row := store.QueryRow("SELECT id, password FROM user WHERE name = $1", name)
+ if err := row.Scan(&u.Id, &u.Password); err != nil {
return nil, false
}
return u, true