mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Allow dialers and TLS configuration to be added directly to MySQLDriver type

Open zombiezen opened this issue 7 years ago • 5 comments

I would like to be able to create MySQL connections with custom TLS configuration and dialers without modifying the package-global registries, especially now that Go 1.10's OpenDB function is available. If the same register functions were available as methods on the driver and modifying a particular driver's state, that would go a long way.

Happy to send a PR to fix.

zombiezen avatar Mar 27 '18 15:03 zombiezen

ref: #705

methane avatar Mar 28 '18 12:03 methane

Ah, I see. Seems like that PR would be closer to what I want, but IIUC the Connector would still depend on package variables. It would be nice to have Connector just take the dialer function or TLS config directly, instead of going through the string indirection.

zombiezen avatar Mar 28 '18 14:03 zombiezen

Ran into this today. Glad to see driver.Connector implemented, but TLS config is not possible without doing parseDSN since cfg.tls is not exported and is only added via ParseDSN

nemith avatar Apr 26 '19 19:04 nemith

+1, would love to see ability to create a driver.Connector from a net.Conn.

The caller can set up tls if necessary.

broady avatar Jun 11 '19 00:06 broady

I dislike registry APIs, and I want to add this too.

But before adding this, we need to decide what should we do for Config.FormatDSN() It doesn't return error for now. What should do we do when the config is not representable by a DSN?

methane avatar Jun 18 '19 10:06 methane