Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334
  1. package main
  2. import (
  3. "fmt"
  4. "git.x2erp.com/qdy/go-base/config"
  5. "git.x2erp.com/qdy/go-base/container"
  6. "git.x2erp.com/qdy/go-db/factory/database"
  7. )
  8. func main() {
  9. // 显示当前使用的数据库配置
  10. config := config.GetConfig()
  11. ctr := container.NewContainer(config)
  12. dbFactory := container.Create(ctr, database.CreateDBFactory)
  13. dbFactory.TestConnection()
  14. // 创建数据库工厂
  15. fmt.Printf("第1次.\n")
  16. dbFactory1 := database.CreateDBFactory(config)
  17. dbFactory1.TestConnection()
  18. fmt.Printf("第2次.\n")
  19. dbFactory2 := container.Create(ctr, database.CreateDBFactory)
  20. dbFactory2.TestConnection()
  21. defer ctr.CloseAll()
  22. }