MCPcopy
hub / github.com/go-gorm/gorm / BeforeUpdate

Method BeforeUpdate

tests/hooks_test.go:39–45  ·  view source on GitHub ↗
(tx *gorm.DB)

Source from the content-addressed store, hash-verified

37}
38
39func (s *Product) BeforeUpdate(tx *gorm.DB) (err error) {
40 if s.Code == "dont_update" {
41 err = errors.New("can't update")
42 }
43 s.BeforeUpdateCallTimes = s.BeforeUpdateCallTimes + 1
44 return
45}
46
47func (s *Product) BeforeSave(tx *gorm.DB) (err error) {
48 if s.Code == "dont_save" {

Callers

nothing calls this directly

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected