goweb/repository/user_role_repository.go

23 lines
413 B
Go
Raw Permalink Normal View History

package repository
import (
2021-08-22 00:13:00 +08:00
"goweb/global"
"goweb/model"
)
type userRoleRepository struct{}
type UserRoleRepository interface {
Migrate() error
}
// NewUserRoleRepository 新建实例
func NewUserRoleRepository() UserRoleRepository {
return userRoleRepository{}
}
// Migrate 初始化数据库结构
func (r userRoleRepository) Migrate() error {
return global.MySQLConn.AutoMigrate(&model.UserRole{})
}