Open new Connection. See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how the DSN string is formatted
(dsn string)
| 79 | // See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how |
| 80 | // the DSN string is formatted |
| 81 | func (d MySQLDriver) Open(dsn string) (driver.Conn, error) { |
| 82 | cfg, err := ParseDSN(dsn) |
| 83 | if err != nil { |
| 84 | return nil, err |
| 85 | } |
| 86 | c := newConnector(cfg) |
| 87 | return c.Connect(context.Background()) |
| 88 | } |
| 89 | |
| 90 | // This variable can be replaced with -ldflags like below: |
| 91 | // go build "-ldflags=-X github.com/go-sql-driver/mysql.driverName=custom" |