Skip to content

Commit

Permalink
opt: use createMany instead of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
JalinWang committed Jun 27, 2022
1 parent 69911d8 commit c77c05d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,11 +947,9 @@ func (a *Adapter) UpdateFilteredPolicies(sec string, ptype string, newPolicies [
tx.Rollback()
return nil, err
}
for i := range newP {
if err := a.customizedDBCreate(tx, &newP[i]); err != nil {
tx.Rollback()
return nil, err
}
if err := a.customizedDBCreateMany(tx, &newP); err != nil {
tx.Rollback()
return nil, err
}

// return deleted rulues
Expand Down

0 comments on commit c77c05d

Please sign in to comment.