DATA-DOG / go-sqlmock

Sql mock driver for golang to test database interactions
Other
6.13k stars 407 forks source link

Fix for Exec(...) mocking with non-standard SQL data types ([]string) #195

Closed berupp closed 5 years ago

berupp commented 5 years ago

Trying to address this issue.

I added two tests in the first change set:

TestCustomValueConverterExec fails due to driver.IsValue(darg)-check, which basically filters all non-default types. I think it is safe to remove this check, and the following reflect.DeepEquals() will successfully handle List and Map data types that are more common these days.

codecov-io commented 5 years ago

Codecov Report

Merging #195 into master will increase coverage by 0.24%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #195      +/-   ##
==========================================
+ Coverage   90.87%   91.11%   +0.24%     
==========================================
  Files          15       15              
  Lines         745      743       -2     
==========================================
  Hits          677      677              
+ Misses         49       48       -1     
+ Partials       19       18       -1
Impacted Files Coverage Δ
expectations_go18.go 86.66% <ø> (+5.41%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e98392b...181c3c5. Read the comment docs.

berupp commented 5 years ago

Note: I changed the Exec(...) fix to be supported by 1.9+ due to driver.NamedValueChecker support being introduced in 1.9 and that seems required for the registered custom driver.ValueConverter to work

l3pp4rd commented 5 years ago

thanks, good work