diff --git a/auth/group.go b/auth/group.go index 0abd336..7c25fa3 100644 --- a/auth/group.go +++ b/auth/group.go @@ -24,7 +24,7 @@ type Group struct { UpdatedAt time.Time } -var BeforeGroupSave func(*Group) error = func(g *Group) error { return nil } +var BeforeGroupSave func(*Group, *gorm.DB) error = nil func (grp *Group) BeforeSave(tx *gorm.DB) (err error) { @@ -32,17 +32,17 @@ func (grp *Group) BeforeSave(tx *gorm.DB) (err error) { if grp.DisplayName == "" { grp.DisplayName = strings.TrimPrefix(grp.Name, SYS_AUTH_PREFIX) } - return BeforeGroupSave(grp) + return BeforeGroupSave(grp, tx) } -var BeforeGroupUpdate func(*Group) error = func(g *Group) error { return nil } +var BeforeGroupUpdate func(*Group, *gorm.DB) error = nil func (grp *Group) BeforeUpdate(tx *gorm.DB) (err error) { - return BeforeGroupUpdate(grp) + return BeforeGroupUpdate(grp, tx) } -var BeforeGroupDelete func(*Group) error = func(g *Group) error { return nil } +var BeforeGroupDelete func(*Group, *gorm.DB) error = nil func (grp *Group) BeforeDelete(tx *gorm.DB) (err error) { - return BeforeGroupDelete(grp) + return BeforeGroupDelete(grp, tx) }