dmarkham / enumer

A Go tool to auto generate methods for your enums
Other
411 stars 63 forks source link

Implement Scan with a type switch #32

Closed vladimiroff closed 4 years ago

vladimiroff commented 4 years ago

This is just a minor (and a bit opinionated) tweak in Scan. While using the generated Scan method, realized that what's being returned from any driver I've stumbled upon is actually []byte instead of string, thus always causing a one failed type assertion on Scan.

Also, totally unsure about the fmt.Stringer case. Haven't really seen a driver that uses some funny types instead of []byte and string.

codecov-io commented 4 years ago

Codecov Report

Merging #32 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #32   +/-   ##
=======================================
  Coverage   66.14%   66.14%           
=======================================
  Files           3        3           
  Lines         449      449           
=======================================
  Hits          297      297           
  Misses        140      140           
  Partials       12       12
Impacted Files Coverage Δ
sql.go 100% <ø> (ø) :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 d46c853...78ada3f. Read the comment docs.

dmarkham commented 4 years ago

@vladimiroff I'm pretty sure you are correct and i like this change. :+1: