package repository import ( "go_api_tmpl/global" "go_api_tmpl/model" ) type roleMenuRepository struct{} type RoleMenuRepository interface { Migrate() error } // NewRoleMenuRepository 新建实例 func NewRoleMenuRepository() RoleMenuRepository { return roleMenuRepository{} } // Migrate 初始化数据库结构 func (r roleMenuRepository) Migrate() error { return global.MySQLConn.AutoMigrate(&model.RoleMenu{}) }