master
Evan Chen 2021-12-19 22:03:33 +08:00
parent 7ac1e42856
commit ea1c75f0e7
1 changed files with 12 additions and 3 deletions

View File

@ -33,17 +33,26 @@ func (grp *Group) BeforeSave(tx *gorm.DB) (err error) {
if grp.DisplayName == "" {
grp.DisplayName = strings.TrimPrefix(grp.Name, SYS_AUTH_PREFIX)
}
return BeforeGroupSave(grp, tx)
if BeforeGroupSave != nil {
err = BeforeGroupSave(grp, tx)
}
return
}
var BeforeGroupUpdate func(*Group, *gorm.DB) error = nil
func (grp *Group) BeforeUpdate(tx *gorm.DB) (err error) {
return BeforeGroupUpdate(grp, tx)
if BeforeGroupUpdate != nil {
err = BeforeGroupUpdate(grp, tx)
}
return
}
var BeforeGroupDelete func(*Group, *gorm.DB) error = nil
func (grp *Group) BeforeDelete(tx *gorm.DB) (err error) {
return BeforeGroupDelete(grp, tx)
if BeforeGroupDelete != nil {
err = BeforeGroupDelete(grp, tx)
}
return
}