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