Skip to content

Commit

Permalink
specify table when to delete records (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Mar 30, 2024
1 parent fef1a94 commit 5d7a098
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func (a *bunAdapter) RemovePolicies(sec string, ptype string, rules [][]string)

func (a *bunAdapter) deleteRecord(existingPolicy CasbinPolicy) error {
query := a.db.NewDelete().
Model((*CasbinPolicy)(nil)).
Where("ptype = ?", existingPolicy.PType)

values := existingPolicy.filterValuesWithKey()
Expand All @@ -253,6 +254,7 @@ func (a *bunAdapter) deleteRecord(existingPolicy CasbinPolicy) error {

func (a *bunAdapter) deleteRecordInTx(tx bun.Tx, existingPolicy CasbinPolicy) error {
query := tx.NewDelete().
Model((*CasbinPolicy)(nil)).
Where("ptype = ?", existingPolicy.PType)

values := existingPolicy.filterValuesWithKey()
Expand Down

0 comments on commit 5d7a098

Please sign in to comment.