- Sort Score
- Num 10 results
- Language All
Results 1 - 1 of 1 for TestUseDBInHooks (0.19 seconds)
-
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 {
Created: Sun Apr 05 09:35:12 GMT 2026 - Last Modified: Mon Jun 17 03:59:06 GMT 2024 - 16.7K bytes - Click Count (0)