finclip-app-manager/infrastructure/db/repo/mysql/app_oper_config.go

32 lines
874 B
Go
Raw Permalink Normal View History

2023-10-31 14:07:26 +08:00
package mysql
import (
"context"
"finclip-app-manager/domain/repository"
)
var _ repository.IAppOperConfigRepo = new(AppOperConfigRepo)
type AppOperConfigRepo struct {
}
func (a *AppOperConfigRepo) Insert(ctx context.Context, item repository.AppOperConfig) error {
err := DB.Model(&repository.AppOperConfig{}).Create(&item).Error
return err
}
func (a *AppOperConfigRepo) Update(ctx context.Context, item repository.AppOperConfig) error {
data := make(map[string]interface{})
data["auto_review_app"] = item.AutoReviewApp
data["update_time"] = item.UpdateTime
return DB.Model(&repository.AppOperConfig{}).Where("id=?", item.Id).Updates(data).Error
}
func (a *AppOperConfigRepo) Find(ctx context.Context) (repository.AppOperConfig, error) {
var item repository.AppOperConfig
err := DB.Model(&repository.AppOperConfig{}).First(&item).Error
return item, err
}