georgysavva / scany

Library for scanning data from a database into Go structs and more
MIT License
1.29k stars 68 forks source link

Adding ScanAllSets to the api #115

Closed kmpm closed 9 months ago

kmpm commented 1 year ago

I made a new function in the API for getting all result sets from sql.Rows. My use case for this is a 3rd party application that uses mssql and have stored procedures returning multiple different results. Possibly also a solution for #114

Tests can be run if you have a Sql Server up an running somewhere and run the tests with the tag with_mssql.

$ go test -tags with_mssql ./...

# if you need a custom connection string for the server you can use the MSSQL_URL environment variable
$ MSSQL_URL="sqlserver://user:pwd@dbhost" go test -tags with_mssql ./...
codecov[bot] commented 1 year ago

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (80c2cc6) 82.74% compared to head (40f2666) 80.41%.

Files Patch % Lines
dbscan/dbscan.go 33.33% 13 Missing and 1 partial :warning:
pgxscan/pgxscan.go 0.00% 3 Missing :warning:
sqlscan/sqlscan.go 50.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #115 +/- ## ========================================== - Coverage 82.74% 80.41% -2.34% ========================================== Files 5 5 Lines 510 531 +21 ========================================== + Hits 422 427 +5 - Misses 73 89 +16 Partials 15 15 ``` | [Flag](https://app.codecov.io/gh/georgysavva/scany/pull/115/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Georgy+Savva) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/georgysavva/scany/pull/115/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Georgy+Savva) | `80.41% <32.14%> (-2.34%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Georgy+Savva#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

georgysavva commented 1 year ago

Hi @kmpm, thank you for adding this new feature to the library. The code and tests look great.

Let me think about it from the design point of view for a bit, though. If I have any questions, I will let you know.

kmpm commented 10 months ago

@georgysavva, you closed the issue I was refering to as completed so I kind of hoped you would have accepted the PR, but no. How can I be of assistance to get this PR merged, or can I help to fix something similar, compatible with multiple result sets, with another design.

georgysavva commented 9 months ago

@kmpm, thank you for your work, and sorry for taking so much time to merge your PR. Here is the new release containing this feature: https://github.com/georgysavva/scany/releases/tag/v2.1.0