- Sort Score
- Result 10 results
- Languages All
Results 1 - 1 of 1 for TestUseDBInHooks (0.16 sec)
-
tests/hooks_test.go
return errors.New("invalid") } return nil } func (s *Product2) BeforeUpdate(tx *gorm.DB) (err error) { tx.Statement.Where("owner != ?", "admin") return } func TestUseDBInHooks(t *testing.T) { DB.Migrator().DropTable(&Product2{}) DB.AutoMigrate(&Product2{}) product := Product2{Name: "Invalid", Price: 100} if err := DB.Create(&product).Error; err == nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:59:06 UTC 2024 - 16.7K bytes - Viewed (0)