Skip to content

feat: add PostgresRowSequence.getColumns() to get column metadata #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SteveLauC
Copy link

@SteveLauC SteveLauC commented Aug 14, 2025

This commit implements PostgresRowSequence.getColumns() to enable users to retrieve column metadata of their query results.

Discussion: #576

Closes #576

This commit implements `PostgresRowSequence.getColumns()` to enable users
to retrieve column metadata of their query results.

Discussion: vapor#576
@SteveLauC
Copy link
Author

SteveLauC commented Aug 14, 2025

  • Based on this comment, RowDescription.Column should stay private, and a new type PostgresColumn is added. This type and its fields are public, but the fields are immutable, and the init() function is private. I did this because I want it to behave like an accessor: users are only allowed to construct it via the getColumns() method, once created, users can only read it.

  • API naming: I would like to directly use columns(), but the compiler complains that there is already a field with the same name. So I go with getColumns().

  • Definition of this new PostgresColumn type: I blindly use the fields of RowDescription.Column

  • Two unit tests are added


Just my two cents — I'm happy to adjust based on the maintainer's feedback. :)

@SteveLauC SteveLauC marked this pull request as ready for review August 14, 2025 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Column Metadata on PostgresRowSequence
1 participant