Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestHooksForSlice (0.22 sec)

  1. tests/hooks_test.go

    	DB.Session(&gorm.Session{SkipHooks: true}).Create(&product2)
    
    	if product2.Price != 0 {
    		t.Errorf("invalid price after create without hooks, got %+v", product2)
    	}
    }
    
    func TestHooksForSlice(t *testing.T) {
    	DB.Migrator().DropTable(&Product3{})
    	DB.AutoMigrate(&Product3{})
    
    	products := []*Product3{
    		{Name: "Product-1", Price: 100},
    		{Name: "Product-2", Price: 200},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
Back to top