Re: [go-nuts] Trouble with pgx package

2021-10-02 Thread Martin Schnabel
Then there are two other problems with your code snippet. You return an error but have no function return parameter declared, so this code would not even compile as is. The second problem is that you call QueryRow with an sql insert statement that does not returns anything unless you add a retur

Re: [go-nuts] Trouble with pgx package

2021-10-02 Thread Martin Schnabel
Hi Денис, QueryRow does not return an error but a Row that you then call Scan on which returns an error. https://pkg.go.dev/github.com/jackc/pgx/v4#Conn.QueryRow You usually call it in combination with scan. err := QueryRow(`…`).Scan(&dest) Have fun! On 10/2/21 12:52 PM, Денис Мухортов wrot

[go-nuts] Trouble with pgx package

2021-10-02 Thread Денис Мухортов
Just started making my first web, I don't quite understand the Query Row function. An error is returned, I process it. What is the error? func save(w http.ResponseWriter, r *http.Request) { login := r.FormValue("login") password := r.FormValue("password") if login == "" || password ==