goweb/repository/menu_repository.go
2021-08-22 00:13:00 +08:00

23 lines
381 B
Go

package repository
import (
"goweb/global"
"goweb/model"
)
type menuRepository struct{}
type MenuRepository interface {
Migrate() error
}
// NewMenuRepository 新建实例
func NewMenuRepository() MenuRepository {
return menuRepository{}
}
// Migrate 初始化数据库结构
func (r menuRepository) Migrate() error {
return global.MySQLConn.AutoMigrate(&model.Menu{})
}