2021-08-20 14:59:13 +08:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
2021-08-22 00:13:00 +08:00
|
|
|
"goweb/global"
|
|
|
|
"goweb/model"
|
2021-08-20 14:59:13 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type roleRepository struct{}
|
|
|
|
|
|
|
|
type RoleRepository interface {
|
|
|
|
Migrate() error
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewRoleRepository 新建实例
|
|
|
|
func NewRoleRepository() RoleRepository {
|
|
|
|
return roleRepository{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Migrate 初始化数据库结构
|
|
|
|
func (r roleRepository) Migrate() error {
|
|
|
|
return global.MySQLConn.AutoMigrate(&model.Role{})
|
|
|
|
}
|