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)
| 174 | |
| 175 | // Open opens a database specified by its database driver type and connection config without verifying the connection. |
| 176 | func 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. |
| 193 | type ExecuteOptions struct { |