georgysavva / scany

Library for scanning data from a database into Go structs and more
MIT License
1.23k stars 67 forks source link

Error after upgrading to v2 #102

Closed graineri closed 1 year ago

graineri commented 1 year ago
type User struct {
  ID string  
  FirstName string
  LastName string 
}

sqlQuery := "SELECT id, first_name, last_name FROM users WHERE id = $1"

var user User
err := pgxscan.Get(ctx, db, &user, sqlQuery, "1234") 

Error: "scanning one: scanning: doing scan: scanFn: scany: scan row into struct fields: number of field descriptions must equal number of destinations, got 3 and 1"

This same code wasn't causing issues with pgx v4 and scany v1. Am I missing anything?