MCPcopy Index your code
hub / github.com/bytebase/bytebase / Open

Function Open

backend/plugin/db/driver.go:176–190  ·  view source on GitHub ↗

Open opens a database specified by its database driver type and connection config without verifying the connection.

(ctx context.Context, dbType storepb.Engine, connectionConfig ConnectionConfig)

Source from the content-addressed store, hash-verified

174
175// Open opens a database specified by its database driver type and connection config without verifying the connection.
176func Open(ctx context.Context, dbType storepb.Engine, connectionConfig ConnectionConfig) (Driver, error) {
177 driversMu.RLock()
178 f, ok := drivers[dbType]
179 driversMu.RUnlock()
180 if !ok {
181 return nil, errors.Errorf("db: unknown driver %v", dbType)
182 }
183
184 driver, err := f().Open(ctx, dbType, connectionConfig)
185 if err != nil {
186 return nil, err
187 }
188
189 return driver, nil
190}
191
192// ExecuteOptions is the options for execute.
193type ExecuteOptions struct {

Callers 2

GetDataSourceDriverMethod · 0.92
getDriverFunction · 0.92

Calls 3

fFunction · 0.85
ErrorfMethod · 0.80
OpenMethod · 0.65

Tested by 1

getDriverFunction · 0.74