master
Evan Chen 2021-12-19 21:42:28 +08:00
parent f10719c212
commit 95419dd651
1 changed files with 6 additions and 6 deletions

View File

@ -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)
}