Closed sergey-tb closed 1 year ago
Isn't calling of rows.Close() method missed in pgxscan.Get() implementation? Can't find it in sources.
err := pgxscan.Get(ctx, db, &user, findUserById, id)
func (api *API) Get(ctx context.Context, db Querier, dst interface{}, query string, args ...interface{}) error { rows, err := db.Query(ctx, query, args...) // shouldn't we defer here? if err != nil { // exits without rows.Close() return fmt.Errorf("scany: query one result row: %w", err) } if err := api.ScanOne(dst, rows); err != nil { return fmt.Errorf("scanning one: %w", err) } return nil }
Thanks
I found out pgx connection.Query() will close rows in case of error. Issue could be closed, thanks.
Isn't calling of rows.Close() method missed in pgxscan.Get() implementation? Can't find it in sources.
Thanks