Annotations: AddMany to not open session if nothing to save (#61117)

This commit is contained in:
Yuri Tseretyan
2023-01-06 21:23:46 -05:00
committed by GitHub
parent 48f1db63ff
commit d44de7f20a

View File

@@ -77,7 +77,9 @@ func (r *xormRepositoryImpl) Add(ctx context.Context, item *annotations.Item) er
func (r *xormRepositoryImpl) AddMany(ctx context.Context, items []annotations.Item) error {
hasTags := make([]annotations.Item, 0)
hasNoTags := make([]annotations.Item, 0)
if len(items) == 0 {
return nil
}
for i := range items {
// The validation logic needs to work in terms of pointers.
// So, force everything else to work in terms of pointers too, to avoid any implicit extra copying.