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