update
parent
7ac1e42856
commit
ea1c75f0e7
|
@ -33,17 +33,26 @@ func (grp *Group) BeforeSave(tx *gorm.DB) (err error) {
|
||||||
if grp.DisplayName == "" {
|
if grp.DisplayName == "" {
|
||||||
grp.DisplayName = strings.TrimPrefix(grp.Name, SYS_AUTH_PREFIX)
|
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
|
var BeforeGroupUpdate func(*Group, *gorm.DB) error = nil
|
||||||
|
|
||||||
func (grp *Group) BeforeUpdate(tx *gorm.DB) (err error) {
|
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
|
var BeforeGroupDelete func(*Group, *gorm.DB) error = nil
|
||||||
|
|
||||||
func (grp *Group) BeforeDelete(tx *gorm.DB) (err error) {
|
func (grp *Group) BeforeDelete(tx *gorm.DB) (err error) {
|
||||||
return BeforeGroupDelete(grp, tx)
|
if BeforeGroupDelete != nil {
|
||||||
|
err = BeforeGroupDelete(grp, tx)
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue