This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
1
[PATCH] Fix user retrieval.
Fixes: https://todo.sr.ht/~brettgilio/snippet/11
---
internal/models/users.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/internal/models/users.go b/internal/models/users.go
index 1cafd53..f91c858 100644
--- a/internal/models/users.go
+++ b/internal/models/users.go
@@ -50,7 +50,7 @@ func (m *UserModel) Insert(username string, email string, password string) (stri
}
func (m *UserModel) Get(id string) (*User, error) {
- stmt := `SELECT id, name, email, hashed_password, created FROM users
+ stmt := `SELECT id, username, email, hashed_password, created FROM users
WHERE id = ?`
row := m.DB.QueryRow(stmt, id)
--
2.37.1
On 7/28/2022 5:36 AM, Alexandru-Sergiu Marton wrote:
> Fixes: https://todo.sr.ht/~brettgilio/snippet/11
> ---
> internal/models/users.go | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/internal/models/users.go b/internal/models/users.go
> index 1cafd53..f91c858 100644
> --- a/internal/models/users.go
> +++ b/internal/models/users.go
> @@ -50,7 +50,7 @@ func (m *UserModel) Insert(username string, email string, password string) (stri
> }
>
> func (m *UserModel) Get(id string) (*User, error) {
> - stmt := `SELECT id, name, email, hashed_password, created FROM users
> + stmt := `SELECT id, username, email, hashed_password, created FROM users
> WHERE id = ?`
>
> row := m.DB.QueryRow(stmt, id)
Well, I certainly feel silly for not catching this simple error. Thank
you, Sergiu. Applied.