feat: 完善后端脚手架基础能力

This commit is contained in:
2026-08-09 01:06:21 +08:00
parent e311f416f2
commit f95311a107
61 changed files with 5630 additions and 521 deletions
+30
View File
@@ -0,0 +1,30 @@
//go:build cgo
package database
import (
"testing"
"skeleton/config"
"go.uber.org/zap"
)
func TestInitSQLiteInMemory(t *testing.T) {
cfg := config.DatabaseConfig{
Driver: "sqlite",
DSN: ":memory:",
MaxIdleConns: 1,
MaxOpenConns: 1,
}
if err := Init(&cfg, zap.NewNop()); err != nil {
t.Fatalf("Init() error = %v", err)
}
t.Cleanup(func() {
_ = Close()
DB = nil
})
if GetDB() == nil {
t.Fatal("GetDB() returned nil")
}
}