change update callback func name
This commit is contained in:
parent
35d9fc7a31
commit
aa7b10be29
@ -41,7 +41,7 @@ func beforeUpdateCallback(scope *Scope) {
|
|||||||
scope.CallMethod("BeforeSave")
|
scope.CallMethod("BeforeSave")
|
||||||
}
|
}
|
||||||
if !scope.HasError() {
|
if !scope.HasError() {
|
||||||
scope.CallMethod("BeforeUpdate")
|
scope.CallMethod("GormBeforeUpdate")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ func updateCallback(scope *Scope) {
|
|||||||
func afterUpdateCallback(scope *Scope) {
|
func afterUpdateCallback(scope *Scope) {
|
||||||
if _, ok := scope.Get("gorm:update_column"); !ok {
|
if _, ok := scope.Get("gorm:update_column"); !ok {
|
||||||
if !scope.HasError() {
|
if !scope.HasError() {
|
||||||
scope.CallMethod("AfterUpdate")
|
scope.CallMethod("GormAfterUpdate")
|
||||||
}
|
}
|
||||||
if !scope.HasError() {
|
if !scope.HasError() {
|
||||||
scope.CallMethod("AfterSave")
|
scope.CallMethod("AfterSave")
|
||||||
|
@ -17,7 +17,7 @@ func (s *Product) BeforeCreate() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Product) BeforeUpdate() (err error) {
|
func (s *Product) GormBeforeUpdate() (err error) {
|
||||||
if s.Code == "dont_update" {
|
if s.Code == "dont_update" {
|
||||||
err = errors.New("can't update")
|
err = errors.New("can't update")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user