MCPcopy
hub / github.com/go-sql-driver/mysql / Open

Method Open

driver.go:81–88  ·  driver.go::MySQLDriver.Open

Open new Connection. See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how the DSN string is formatted

(dsn string)

Source from the content-addressed store, hash-verified

79// See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how
80// the DSN string is formatted
81func (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"

Callers 15

handleInFileRequestMethod · 0.80
runTestsFunction · 0.80
runTestsParallelFunction · 0.80
TestLoadDataFunction · 0.80
testDialErrorFunction · 0.80
TestCustomDialFunction · 0.80
TestUnixSocketAuthFailFunction · 0.80
TestEmptyPasswordFunction · 0.80
TestConnectionAttributesFunction · 0.80

Calls 3

ParseDSNFunction · 0.85
newConnectorFunction · 0.85
ConnectMethod · 0.45

Tested by 15

runTestsFunction · 0.64
runTestsParallelFunction · 0.64
TestLoadDataFunction · 0.64
testDialErrorFunction · 0.64
TestCustomDialFunction · 0.64
TestUnixSocketAuthFailFunction · 0.64
TestEmptyPasswordFunction · 0.64
TestConnectionAttributesFunction · 0.64
TestErrorInMultiResultFunction · 0.64