I'm running a pretty straightforward query using the database/sql
and lib/pq
(postgres) packages and I want to toss the results of some of the fields into a slice, but I need to know how big to make the slice.
The only solution I can find is to do another query that is just SELECT COUNT(*) FROM tableName;
.
Is there a way to both get the result of the query AND the count of returned rows in one query?