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

32 lines
881 B
Go
Raw Normal View History

2023-10-31 14:07:26 +08:00
package mongo
import (
"context"
"finclip-app-manager/domain/repository"
"gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo/bson"
)
var _ repository.IAppOperConfigRepo = new(AppOperConfigRepo)
type AppOperConfigRepo struct {
}
func (a *AppOperConfigRepo) Insert(ctx context.Context, item repository.AppOperConfig) error {
return appOperConfigTable.Insert(ctx, item)
}
func (a *AppOperConfigRepo) Update(ctx context.Context, item repository.AppOperConfig) error {
upInfo := make(map[string]interface{})
upInfo["auto_review_app"] = item.AutoReviewApp
upInfo["update_time"] = item.UpdateTime
return appTable.UpdateOne(ctx, bson.M{"_id": item.Id}, bson.M{"$set": upInfo})
}
func (a *AppOperConfigRepo) Find(ctx context.Context) (repository.AppOperConfig, error) {
item := repository.AppOperConfig{}
err := appTable.GetOne(ctx, bson.M{}, &item)
return item, err
}