MCPcopy Create free account
hub / github.com/cloudwan/gohan / dropDatabase

Function dropDatabase

cli/generate.go:67–84  ·  view source on GitHub ↗
(dbName string)

Source from the content-addressed store, hash-verified

65}
66
67func dropDatabase(dbName string) error {
68 config := util.GetConfig()
69 databaseType := config.GetString("database/type", "mysql")
70 databaseConnection := os.Getenv("DATABASE_CONNECTION")
71 if databaseConnection == "" {
72 databaseConnection = config.GetString("database/connection", "")
73 }
74 db, err := sql.Open(databaseType, databaseConnection)
75 if err != nil {
76 return nil
77 }
78 defer db.Close()
79 _, err = db.Exec("drop database " + dbName)
80 if err != nil {
81 return nil
82 }
83 return nil
84}
85
86func gohanGenerate(c *cli.Context) {
87 path := c.String("output")

Callers

nothing calls this directly

Calls 3

GetStringMethod · 0.80
CloseMethod · 0.65
ExecMethod · 0.65

Tested by

no test coverage detected