Skip to content

Create tokio_postgres::Row for unit tests. #910

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
BratSinot opened this issue Jun 23, 2022 · 1 comment
Open

Create tokio_postgres::Row for unit tests. #910

BratSinot opened this issue Jun 23, 2022 · 1 comment

Comments

@BratSinot
Copy link
Contributor

BratSinot commented Jun 23, 2022

Greetings!

Any way to create tokio_postgres::Row for unit-tests?

@BratSinot BratSinot changed the title Create Row for unit tests. Create tokio_postgres::Row for unit tests. Jun 23, 2022
@sfackler
Copy link
Owner

The only way to create a Row is currently to query it from a Postgres instance.

hunts pushed a commit to hunts/rust-postgres that referenced this issue Jan 5, 2023
Added RowDescription trait, and let rows to share the same description
rather than having a copy in each row (think when there are thousand of
them in the result).

Added RowBuilder to support adding stubs of row data in unit tests.

Currently, the library users have no chooice but have to use integration
tests for testing Postgres data access code. With the changes in this
commit, the `tokio-postgres` lib users can use RowBuilder to create
sutbs to verify the deserialization from database result (Rows) to
custom stucts in unit tests.

It can also serves as a base for future implementation of certain kind
of mocks of the db connection.

Related-to sfackler#910 sfackler#950
hunts added a commit to hunts/rust-postgres that referenced this issue Jan 5, 2023
Added RowDescription trait, and let rows to share the same description
rather than having a copy in each row (think when there are thousand of
them in the result).

Added RowBuilder to support adding stubs of row data in unit tests.

Currently, the library users have no chooice but have to use integration
tests for testing Postgres data access code. With the changes in this
commit, the `tokio-postgres` lib users can use RowBuilder to create
sutbs to verify the deserialization from database result (Rows) to
custom stucts in unit tests.

It can also serves as a base for future implementation of certain kind
of mocks of the db connection.

Related-to sfackler#910 sfackler#950
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

No branches or pull requests

2 participants