pashagolub / pgxmock

pgx mock driver for golang to test database interactions
Other
393 stars 49 forks source link

Be more flexible about scanning into variables that don't exactly match the mocked values. #103

Closed wttw closed 2 years ago

wttw commented 2 years ago

This checks that source and destination values are assignable before trying to set the destination via reflection, avoiding panics when source and destination are different structs.

It also adds some special cases, snarfed from database/sql, to allow scanning into a destination that's not identical to the source so, e.g., a literal int used in AddRow() can be scanned into an int32. That makes the mocks less annoying to write.

Fixes bug #102.

pashagolub commented 2 years ago

Superseded by #113