Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zombiezen opened this issue Mar 27, 2018 · 5 comments · Fixed by #1422
Closed

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

zombiezen opened this issue Mar 27, 2018 · 5 comments · Fixed by #1422
Milestone

Comments

@zombiezen
Copy link
Contributor

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.

@methane
Copy link
Member

methane commented Mar 28, 2018

ref: #705

@zombiezen
Copy link
Contributor Author

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.

@nemith
Copy link
Contributor

nemith commented Apr 26, 2019

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

@broady
Copy link

broady commented Jun 11, 2019

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

The caller can set up tls if necessary.

@methane
Copy link
Member

methane commented Jun 18, 2019

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?

julienschmidt added a commit that referenced this issue Jan 3, 2020
Not all configs may be representable by a DSN string in the future, e.g. #771

Updates #771.
@julienschmidt julienschmidt modified the milestones: v1.5.0, v1.6.0 Jan 3, 2020
@julienschmidt julienschmidt modified the milestones: v1.6.0, v1.7.0 Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants