feature/v2.2.0 (#2154)

This commit is contained in:
John Guo
2022-09-26 22:11:13 +08:00
committed by GitHub
parent 9dc97f4b0d
commit 141ca62c6d
147 changed files with 7965 additions and 1806 deletions

View File

@ -59,7 +59,7 @@ func Database(name ...string) gdb.DB {
if fileConfig, ok := Config().GetAdapter().(*gcfg.AdapterFile); ok {
if _, err = fileConfig.GetFilePath(); err != nil {
panic(gerror.WrapCode(gcode.CodeMissingConfiguration, err,
`configuration not found, did you miss the configuration file or the misspell the configuration file name`,
`configuration not found, did you miss the configuration file or misspell the configuration file name`,
))
}
}

View File

@ -41,15 +41,16 @@ func Test_Database(t *testing.T) {
time.Sleep(500 * time.Millisecond)
// fmt.Println("gins Test_Database", Config().Get("test"))
dbDefault := gins.Database()
dbTest := gins.Database("test")
var (
db = gins.Database()
dbDefault = gins.Database("default")
)
t.AssertNE(db, nil)
t.AssertNE(dbDefault, nil)
t.AssertNE(dbTest, nil)
t.Assert(db.PingMaster(), nil)
t.Assert(db.PingSlave(), nil)
t.Assert(dbDefault.PingMaster(), nil)
t.Assert(dbDefault.PingSlave(), nil)
t.Assert(dbTest.PingMaster(), nil)
t.Assert(dbTest.PingSlave(), nil)
})
}

View File

@ -9,7 +9,7 @@ test = "v=2"
user = "root"
pass = "12345678"
name = "test"
type = "test"
type = "default"
role = "master"
weight = "1"
charset = "utf8"
@ -19,7 +19,7 @@ test = "v=2"
user = "root"
pass = "12345678"
name = "test"
type = "test"
type = "default"
role = "master"
weight = "1"
charset = "utf8"