refactor: 新增base.Repo与base.App,重构repo与app层代码

This commit is contained in:
meilin.huang
2023-10-26 17:15:49 +08:00
parent 10f6b03fb5
commit a1303b52eb
115 changed files with 1867 additions and 1696 deletions

View File

@@ -3,26 +3,13 @@ package persistence
import (
"mayfly-go/internal/auth/domain/entity"
"mayfly-go/internal/auth/domain/repository"
"mayfly-go/pkg/gormx"
"mayfly-go/pkg/base"
)
type oauth2AccountRepoImpl struct{}
type oauth2AccountRepoImpl struct {
base.RepoImpl[*entity.Oauth2Account]
}
func newAuthAccountRepo() repository.Oauth2Account {
return new(oauth2AccountRepoImpl)
}
func (a *oauth2AccountRepoImpl) GetOAuthAccount(condition *entity.Oauth2Account, cols ...string) error {
return gormx.GetBy(condition, cols...)
}
func (a *oauth2AccountRepoImpl) SaveOAuthAccount(e *entity.Oauth2Account) error {
if e.Id == 0 {
return gormx.Insert(e)
}
return gormx.UpdateById(e)
}
func (a *oauth2AccountRepoImpl) DeleteBy(e *entity.Oauth2Account) {
gormx.DeleteByCondition(e)
return &oauth2AccountRepoImpl{base.RepoImpl[*entity.Oauth2Account]{M: new(entity.Oauth2Account)}}
}