feat 接入Prometheus

This commit is contained in:
2025-12-17 21:05:12 +08:00
parent efa9f50d3e
commit da91cff056
24 changed files with 289 additions and 60 deletions

View File

@@ -0,0 +1,33 @@
package utils
import (
"gorm.io/driver/mysql"
"gorm.io/gen"
"gorm.io/gorm"
"testing"
)
func TestGenGormStruct(t *testing.T) {
dsn := "user:password@tcp(47.108.184.184:3306)/point?charset=utf8mb4&parseTime=True&loc=Local"
db, err := gorm.Open(mysql.Open(dsn))
if err != nil {
panic(err)
}
g := gen.NewGenerator(gen.Config{
OutPath: "./model", // 生成的 model 文件路径
})
g.UseDB(db)
// 生成所有表的 struct
g.ApplyBasic(g.GenerateAllTable()...)
// 或者指定表
// g.ApplyBasic(
// g.GenerateModel("users"),
// g.GenerateModel("orders"),
// )
g.Execute()
}