mirror of
https://gitlab.52pay.top/go/easygoadmin.git
synced 2025-09-27 02:08:02 +08:00
feat: 增加数据库前缀配置
增加数据库前缀配置
This commit is contained in:
@@ -44,6 +44,7 @@ type database struct {
|
||||
Slave string
|
||||
Debug bool
|
||||
Log string
|
||||
Prev string
|
||||
}
|
||||
|
||||
type redisCfg struct {
|
||||
|
3
main.go
3
main.go
@@ -7,6 +7,7 @@ import (
|
||||
widget2 "gitlab.52pay.top/go/easygoadmin/app/widget"
|
||||
_ "gitlab.52pay.top/go/easygoadmin/boot"
|
||||
cfg "gitlab.52pay.top/go/easygoadmin/library/cfg"
|
||||
"gitlab.52pay.top/go/easygoadmin/router"
|
||||
_ "gitlab.52pay.top/go/easygoadmin/router"
|
||||
"html/template"
|
||||
"path/filepath"
|
||||
@@ -34,7 +35,7 @@ func main() {
|
||||
//router.HTMLRender = LoadTemplates("views")
|
||||
//router.GET("level/index", controller.Level.Index)
|
||||
//router.GET("position/index", controller.Position.Index)
|
||||
//router.Run(":8080") // 监听并在 0.0.0.0:8080 上启动服务
|
||||
router.Router.Run(":9097") // 监听并在 0.0.0.0:8080 上启动服务
|
||||
}
|
||||
|
||||
func LoadTemplates(templatesDir string) multitemplate.Renderer {
|
||||
|
@@ -20,6 +20,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var Router *gin.Engine
|
||||
|
||||
func init() {
|
||||
//gin.SetMode(gin.ReleaseMode)
|
||||
//gin.SetMode(gin.DebugMode)
|
||||
@@ -301,6 +303,7 @@ func init() {
|
||||
example2.POST("/delete/:ids", controller.Example2.Delete)
|
||||
example2.POST("/setStatus", controller.Example2.Status)
|
||||
}
|
||||
Router = router
|
||||
// 启动
|
||||
//router.Run(":9097")
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ func init() {
|
||||
XormDb.SetMaxOpenConns(30)
|
||||
|
||||
// 结构体与数据表的映射
|
||||
tbMapper := core.NewPrefixMapper(core.SnakeMapper{}, "sys_")
|
||||
tbMapper := core.NewPrefixMapper(core.SnakeMapper{}, config.Database.Prev)
|
||||
XormDb.SetTableMapper(tbMapper)
|
||||
|
||||
// 开启调试模式和打印日志,会在控制台打印执行的sql
|
||||
|
Reference in New Issue
Block a user