- Sort Score
- Result 10 results
- Languages All
Results 1 - 6 of 6 for AfterCreate (0.14 sec)
-
schema/callbacks_test.go
return nil } func (UserWithCallback) AfterCreate(*gorm.DB) error { return nil } func TestCallback(t *testing.T) { user, err := schema.Parse(&UserWithCallback{}, &sync.Map{}, schema.NamingStrategy{}) if err != nil { t.Fatalf("failed to parse user with callback, got error %v", err) } for _, str := range []string{"BeforeSave", "AfterCreate"} {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 939 bytes - Viewed (0) -
callbacks/create.go
} } } } } // AfterCreate after create hooks func AfterCreate(db *gorm.DB) { if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.AfterSave || db.Statement.Schema.AfterCreate) { callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) { if db.Statement.Schema.AfterCreate { if i, ok := value.(AfterCreateInterface); ok {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Apr 08 03:29:55 UTC 2024 - 12.5K bytes - Viewed (0) -
callbacks/interfaces.go
package callbacks import "gorm.io/gorm" type BeforeCreateInterface interface { BeforeCreate(*gorm.DB) error } type AfterCreateInterface interface { AfterCreate(*gorm.DB) error } type BeforeUpdateInterface interface { BeforeUpdate(*gorm.DB) error } type AfterUpdateInterface interface { AfterUpdate(*gorm.DB) error } type BeforeSaveInterface interface { BeforeSave(*gorm.DB) error }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 27 07:03:57 UTC 2020 - 667 bytes - Viewed (0) -
callbacks/callbacks.go
createCallback.Register("gorm:create", Create(config)) createCallback.Register("gorm:save_after_associations", SaveAfterAssociations(true)) createCallback.Register("gorm:after_create", AfterCreate) createCallback.Match(enableTransaction).Register("gorm:commit_or_rollback_transaction", CommitOrRollbackTransaction) createCallback.Clauses = config.CreateClauses queryCallback := db.Callback().Query()
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Oct 27 23:56:55 UTC 2021 - 3.3K bytes - Viewed (0) -
schema/schema.go
) type callbackType string const ( callbackTypeBeforeCreate callbackType = "BeforeCreate" callbackTypeBeforeUpdate callbackType = "BeforeUpdate" callbackTypeAfterCreate callbackType = "AfterCreate" callbackTypeAfterUpdate callbackType = "AfterUpdate" callbackTypeBeforeSave callbackType = "BeforeSave" callbackTypeAfterSave callbackType = "AfterSave" callbackTypeBeforeDelete callbackType = "BeforeDelete"
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 20 12:19:31 UTC 2024 - 13.7K bytes - Viewed (0) -
tests/hooks_test.go
} s.BeforeSaveCallTimes = s.BeforeSaveCallTimes + 1 return } func (s *Product) AfterFind(tx *gorm.DB) (err error) { s.AfterFindCallTimes = s.AfterFindCallTimes + 1 return } func (s *Product) AfterCreate(tx *gorm.DB) (err error) { return tx.Model(s).UpdateColumn("AfterCreateCallTimes", s.AfterCreateCallTimes+1).Error } func (s *Product) AfterUpdate(tx *gorm.DB) (err error) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:59:06 UTC 2024 - 16.7K bytes - Viewed (0)