23 lines
393 B
Go
23 lines
393 B
Go
package repository
|
|
|
|
import (
|
|
"go_api_tmpl/global"
|
|
"go_api_tmpl/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{})
|
|
}
|