+func (d *Database) GetUserById(id int) (User, error) {
+ var user User
+ err := d.sqldb.QueryRow("SELECT id, username, password_hash, is_admin FROM users WHERE id = ?", id).Scan(&user.Id, &user.Username, &user.PasswordHash, &user.IsAdmin)
+ if err != nil {
+ return User{}, errors.New("no user with that id")
+ }
+ return user, nil
+}
+