MCPcopy Create free account
hub / github.com/bytebase/bytebase / createMySQLDriver

Function createMySQLDriver

backend/plugin/schema/mysql/testutil_test.go:13–30  ·  view source on GitHub ↗

createMySQLDriver creates and opens a MySQL driver for the specified database. This is a shared helper function for tests.

(ctx context.Context, host, port, database string)

Source from the content-addressed store, hash-verified

11// createMySQLDriver creates and opens a MySQL driver for the specified database.
12// This is a shared helper function for tests.
13func createMySQLDriver(ctx context.Context, host, port, database string) (db.Driver, error) {
14 driver := &mysqldb.Driver{}
15 config := db.ConnectionConfig{
16 DataSource: &storepb.DataSource{
17 Type: storepb.DataSourceType_ADMIN,
18 Username: "root",
19 Host: host,
20 Port: port,
21 Database: database,
22 },
23 Password: "root-password",
24 ConnectionContext: db.ConnectionContext{
25 EngineVersion: "8.0",
26 DatabaseName: database,
27 },
28 }
29 return driver.Open(ctx, storepb.Engine_MYSQL, config)
30}

Calls 1

OpenMethod · 0.95

Tested by

no test coverage detected