b43f968b6c
- 在应用程序中新增对达梦数据库(DM)的配置和连接支持 - 实现 SetDmDB 函数以配置达梦数据库连接 - 更新数据库操作逻辑,支持达梦特有的 SQL 语法和功能 - 在相关文件中添加达梦数据库的处理逻辑,包括表创建、数据插入和查询 - 更新 go.mod 和 go.sum 文件以引入达梦数据库驱动 - 增强文档,详细说明达梦数据库的配置和使用方法
44 lines
760 B
Go
44 lines
760 B
Go
package app
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
. "code.hoteas.com/golang/hotime"
|
|
)
|
|
|
|
var ProjectTest = ProjTest{
|
|
"test": TestTest,
|
|
"mysql": MysqlTest,
|
|
"dmdb": DmdbTest,
|
|
"cache": CacheTest,
|
|
}
|
|
|
|
var testApp *TestApp
|
|
|
|
func TestMain(m *testing.M) {
|
|
// Go test 的 CWD 是包目录 example/app/,切回 example/ 使相对路径正确
|
|
_ = os.Chdir("..")
|
|
|
|
testApp = NewTestApp("config/config.json",
|
|
TestProj{
|
|
"app": {
|
|
Proj: Project,
|
|
Tests: ProjectTest,
|
|
},
|
|
},
|
|
)
|
|
|
|
// 在测试前初始化各数据库的测试表和种子数据
|
|
SetupDatabase(&testApp.Db)
|
|
|
|
code := m.Run()
|
|
testApp.PrintCoverage()
|
|
testApp.GenerateSwagger("My API", "1.0.0", testApp.Config.GetString("tpt"))
|
|
os.Exit(code)
|
|
}
|
|
|
|
func TestApi(t *testing.T) {
|
|
testApp.RunTests(t)
|
|
}
|