MCPcopy Index your code
hub / github.com/apache/answer / initDatabase

Function initDatabase

internal/cli/reset_password.go:261–273  ·  view source on GitHub ↗
(driver, connection string)

Source from the content-addressed store, hash-verified

259}
260
261func initDatabase(driver, connection string) (*xorm.Engine, error) {
262 dataConf := &data.Database{Driver: driver, Connection: connection}
263 if !CheckDBConnection(dataConf) {
264 return nil, fmt.Errorf("database connection check failed")
265 }
266
267 engine, err := data.NewDB(false, dataConf)
268 if err != nil {
269 return nil, err
270 }
271
272 return engine, nil
273}
274
275func printWarning(msg string) {
276 if runtime.GOOS == "windows" {

Callers 1

ResetPasswordFunction · 0.70

Calls 2

NewDBFunction · 0.92
CheckDBConnectionFunction · 0.85

Tested by

no test coverage detected