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

Function CheckDBConnection

internal/cli/install_check.go:40–55  ·  view source on GitHub ↗

CheckDBConnection check database whether the connection is normal

(dataConf *data.Database)

Source from the content-addressed store, hash-verified

38
39// CheckDBConnection check database whether the connection is normal
40func CheckDBConnection(dataConf *data.Database) bool {
41 db, err := data.NewDB(false, dataConf)
42 if err != nil {
43 fmt.Printf("connection database failed: %s\n", err)
44 return false
45 }
46 defer func() {
47 _ = db.Close()
48 }()
49 if err = db.Ping(); err != nil {
50 fmt.Printf("connection ping database failed: %s\n", err)
51 return false
52 }
53
54 return true
55}
56
57// CheckDBTableExist check database whether the table is already exists
58func CheckDBTableExist(dataConf *data.Database) bool {

Callers 4

CheckConfigFileFunction · 0.92
CheckDatabaseFunction · 0.92
command.goFile · 0.92
initDatabaseFunction · 0.85

Calls 2

NewDBFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected