95 lines
2.8 KiB
Go
95 lines
2.8 KiB
Go
package mysql
|
|
|
|
import (
|
|
appstorage "hyapp/services/user-service/internal/storage/mysql/app"
|
|
authstorage "hyapp/services/user-service/internal/storage/mysql/auth"
|
|
cpstorage "hyapp/services/user-service/internal/storage/mysql/cp"
|
|
devicestorage "hyapp/services/user-service/internal/storage/mysql/device"
|
|
hoststorage "hyapp/services/user-service/internal/storage/mysql/host"
|
|
identitystorage "hyapp/services/user-service/internal/storage/mysql/identity"
|
|
invitestorage "hyapp/services/user-service/internal/storage/mysql/invite"
|
|
mictimestorage "hyapp/services/user-service/internal/storage/mysql/mictime"
|
|
regionstorage "hyapp/services/user-service/internal/storage/mysql/region"
|
|
userstorage "hyapp/services/user-service/internal/storage/mysql/user"
|
|
)
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回 App 注册表存储对象。
|
|
func (r *Repository) AppRepository() *appstorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return appstorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回认证领域存储对象。
|
|
func (r *Repository) AuthRepository() *authstorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return authstorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回用户主数据存储对象。
|
|
func (r *Repository) UserRepository() *userstorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return userstorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回短号领域存储对象。
|
|
func (r *Repository) IdentityRepository() *identitystorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return identitystorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回国家/区域领域存储对象。
|
|
func (r *Repository) RegionRepository() *regionstorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return regionstorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回设备推送 token 存储对象。
|
|
func (r *Repository) DeviceRepository() *devicestorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return devicestorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回 Host 领域存储对象。
|
|
func (r *Repository) HostRepository() *hoststorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return hoststorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回邀请关系和计数存储对象。
|
|
func (r *Repository) InviteRepository() *invitestorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return invitestorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回用户麦上时长存储对象。
|
|
func (r *Repository) MicTimeRepository() *mictimestorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return mictimestorage.New(r.db)
|
|
}
|
|
|
|
// 基于 user-service 共享 MySQL 连接池返回 CP/兄弟/姐妹关系存储对象。
|
|
func (r *Repository) CPRepository() *cpstorage.Repository {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return cpstorage.New(r.db)
|
|
}
|