s3 complete

This commit is contained in:
withchao
2023-03-06 16:40:57 +08:00
parent a2674bfe9f
commit 3ea0d1f765
10 changed files with 172 additions and 47 deletions
@@ -38,3 +38,15 @@ func (o *ObjectHashGorm) Create(ctx context.Context, h []*relation.ObjectHashMod
}()
return utils.Wrap1(o.DB.Create(h).Error)
}
func (o *ObjectHashGorm) DeleteNoCitation(ctx context.Context, engine string, num int) (list []*relation.ObjectHashModel, err error) {
defer func() {
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "engine", engine, "num", num, "objectHash", list)
}()
err = o.DB.Table(relation.ObjectHashModelTableName, "as h").Select("h.*").
Joins("LEFT JOIN "+relation.ObjectInfoModelTableName+" as i ON h.hash = i.hash").
Where("h.engine = ? AND i.hash IS NULL", engine).
Limit(num).
Find(&list).Error
return list, utils.Wrap1(err)
}