117 lines
2.5 KiB
Go
117 lines
2.5 KiB
Go
package impl
|
|
|
|
import (
|
|
"finclip-app-manager/domain/repository"
|
|
"finclip-app-manager/infrastructure/config"
|
|
"finclip-app-manager/infrastructure/db/repo/mongo"
|
|
"finclip-app-manager/infrastructure/db/repo/mysql"
|
|
)
|
|
|
|
func InitAppRepo() repository.AppRepository {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.AppRepo{}
|
|
default:
|
|
return &mongo.AppRepo{}
|
|
}
|
|
}
|
|
|
|
func InitBuildInfoRepo() repository.IAppBuildInfoRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.AppBuildInfoMysqlRepo{}
|
|
default:
|
|
return &mongo.AppBuildInfoMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitBindingRepo() repository.IBindingRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.BindingByMysqlRepo{}
|
|
default:
|
|
return &mongo.BindingByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitBundleRepo() repository.IBundleRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.BundleByMysqlRepo{}
|
|
default:
|
|
return &mongo.BundleByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitMenuInfoRepo() repository.IMenuInfoRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.MenuInfoByMysqlRepo{}
|
|
default:
|
|
return &mongo.MenuInfoByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitQrCodeInfoRepo() repository.IQrCodeInfoRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.QrCodeInfoByMysqlRepo{}
|
|
default:
|
|
return &mongo.QrCodeInfoByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitTypeConfigRepo() repository.ITypeConfigRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.TypeConfigByMysqlRepo{}
|
|
default:
|
|
return &mongo.TypeConfigByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitLinkAuditRepo() repository.ILinkAuditRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.LinkAuditByMysqlRepo{}
|
|
default:
|
|
return &mongo.LinkAuditByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitRedDotRepo() repository.IRedDotRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.RedDotByMysqlRepo{}
|
|
default:
|
|
return &mongo.RedDotByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitAppTempInfoRepo() repository.IAppTempInfoRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.AppTempInfoByMysqlRepo{}
|
|
default:
|
|
return &mongo.AppTempInfoByMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitPrivacySettingRepo() repository.IPrivacySettingRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.PrivacySettingRepoMysqlRepo{}
|
|
default:
|
|
return &mongo.PrivacySettingRepoMongoRepo{}
|
|
}
|
|
}
|
|
|
|
func InitAppOperConfigRepo() repository.IAppOperConfigRepo {
|
|
switch config.GetConfig().DBMode {
|
|
case "mysql":
|
|
return &mysql.AppOperConfigRepo{}
|
|
default:
|
|
return &mongo.AppOperConfigRepo{}
|
|
}
|
|
}
|