Open conradludgate opened 3 years ago
Hey @conradludgate thanks for doing this, it looks like a great contribution! Is there any way to test this?
Hey @conradludgate thanks for doing this, it looks like a great contribution! Is there any way to test this?
Sure! I'll look into it later
sql.Open
internally makes use of theDriverContext
interface, and if aDriver
does not implement it, it creates a light wrapper1.This
DriverContext
provides better context support as well as providing some useful error checking upfront. For instance, themysql
driver can check theDSN
value before opening a connection to see if it's well formed. That way you get an error instantly instead of an error when making your first sql query1: https://github.com/golang/go/blob/d0dd26a88c019d54f22463daae81e785f5867565/src/database/sql/sql.go#L832 https://github.com/golang/go/blob/d0dd26a88c019d54f22463daae81e785f5867565/src/database/sql/sql.go#L755-L766