pgtyped icon indicating copy to clipboard operation
pgtyped copied to clipboard

How to get rowCount from result

Open mcchrish opened this issue 5 years ago • 2 comments

Node pg returns the rowCount property of the result. https://node-postgres.com/api/result#properties

How do you get this value using pgtyped?

This is important for pagination.

mcchrish avatar Aug 09 '20 10:08 mcchrish

My bad, I don't think rowCount can help with pagination. I'll still leave the issue open just in case anyone need the rowCount value for something.

mcchrish avatar Aug 09 '20 10:08 mcchrish

Yes. This has been an inconvenient for me already as well. I think it would be very nice to be the less intrusive as possible on how the actual queries are executed.

Besides returning the full response, right now the generated code uses

export const QueryName = new PreparedQuery<IQueryNameParams,IQueryNameResult>(queryNameIR);

with PreparedQuery coming from @pgtyped/query. I haven't checked what PreparedQuery does, but it would be great to be able to run it through normal pool.client manually fo instance. Though I guess there might be some technical limitations to do that.

davazp avatar Aug 10 '20 10:08 davazp