postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Access columns data when using forEach/cursor

Open mikeburgh opened this issue 3 years ago • 1 comments

When using the .forEach or .cursor methods to iterate returned rows (in the case of large datasets) is there a way to access the column definition information prior to or during that iteration ?

mikeburgh avatar Oct 25 '22 01:10 mikeburgh

and when have .forEach, why not have an index? a.k.a design it mimic Array.forEach better, like:

await sql ` <sql-to-generate-large-datasets> ` .forEach((row, index, array) => {}, thisArg)

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach

in the form of .forEach((row, index, array) => {}, thisArg) I don't really care about array, thisArg but the index is really needed, and useful

tx0c avatar Nov 04 '22 15:11 tx0c