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)
| 11 | // createMySQLDriver creates and opens a MySQL driver for the specified database. |
| 12 | // This is a shared helper function for tests. |
| 13 | func 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 | } |
no test coverage detected