Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for BeforeUpdate (0.32 sec)

  1. tests/hooks_test.go

    func (s *Product) BeforeCreate(tx *gorm.DB) (err error) {
    	if s.Code == "Invalid" {
    		err = errors.New("invalid product")
    	}
    	s.BeforeCreateCallTimes = s.BeforeCreateCallTimes + 1
    	return
    }
    
    func (s *Product) BeforeUpdate(tx *gorm.DB) (err error) {
    	if s.Code == "dont_update" {
    		err = errors.New("can't update")
    	}
    	s.BeforeUpdateCallTimes = s.BeforeUpdateCallTimes + 1
    	return
    }
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 17 03:59:06 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  2. schema/schema.go

    	"sync"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    )
    
    type callbackType string
    
    const (
    	callbackTypeBeforeCreate callbackType = "BeforeCreate"
    	callbackTypeBeforeUpdate callbackType = "BeforeUpdate"
    	callbackTypeAfterCreate  callbackType = "AfterCreate"
    	callbackTypeAfterUpdate  callbackType = "AfterUpdate"
    	callbackTypeBeforeSave   callbackType = "BeforeSave"
    	callbackTypeAfterSave    callbackType = "AfterSave"
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Jun 20 12:19:31 UTC 2024
    - 13.7K bytes
    - Viewed (0)
Back to top