Open phiresky opened 6 years ago
I think we can wrap db.query
so:
let persons = await wrapped_query(from(Persons).select(Persons.$all));
// here we know the type of persons is (typeof Persons.obj)[]
// or no wrapped version
let persons: (typeof Persons.obj)[] = db.query(from(Persons).select(Persons.$all));
With pg you can get the number of updated / inserted rows like this:
const {rowCount} = await db.query("update ....");
without needing aRETURNING
statement.specifically, the return type of Query in
pg
isThis library always returns only the
rows
property of that interface, which is mostly what you want, but in some cases getting the rowCount is useful (e.g. for performance of not having to return an array).