Skip to content

Access columns data when using forEach/cursor #514

@mikeburgh

Description

@mikeburgh

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 ?

Activity

tx0c

tx0c commented on Nov 4, 2022

@tx0c

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @porsager@mikeburgh@tx0c

        Issue actions

          Access columns data when using forEach/cursor · Issue #514 · porsager/postgres