Add name to User
This commit is contained in:
parent
c0d6ae1157
commit
099ae5fe8a
@ -14,8 +14,8 @@ type UserService struct {
|
||||
// User returns a user for a given id.
|
||||
func (s *UserService) User(id int) (*budgeteer.User, error) {
|
||||
var u budgeteer.User
|
||||
row := s.DB.QueryRow(`SELECT id, email, password FROM users WHERE id = $1`, id)
|
||||
if err := row.Scan(&u.ID, &u.Email, &u.Password); err != nil {
|
||||
row := s.DB.QueryRow(`SELECT id, email, password, name FROM users WHERE id = $1`, id)
|
||||
if err := row.Scan(&u.ID, &u.Email, &u.Password, &u.Name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &u, nil
|
||||
|
5
user.go
5
user.go
@ -1,11 +1,14 @@
|
||||
package budgeteer
|
||||
|
||||
// User struct contains Login information
|
||||
type User struct {
|
||||
ID int
|
||||
ID int
|
||||
Email string
|
||||
Password string
|
||||
Name string
|
||||
}
|
||||
|
||||
// UserService provides Methods for CRUD of Users
|
||||
type UserService interface {
|
||||
User(id int) (*User, error)
|
||||
//Users() ([]*User, error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user