Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for omitmany2many (0.05 sec)

  1. tests/associations_many2many_test.go

    	if DB.Model(&user).Association("Languages").Find(&languages); len(languages) != 2 {
    		t.Errorf("languages count should be %v, but got %v", 2, len(languages))
    	}
    
    	newLang := Language{Code: "omitmany2many", Name: "omitmany2many"}
    	if err := DB.Model(&user).Omit("Languages.*").Association("Languages").Replace(&newLang); err == nil {
    		t.Errorf("should failed to insert languages due to constraint failed, error: %v", err)
    	}
    }
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Jun 10 13:05:19 UTC 2023
    - 13.2K bytes
    - Viewed (0)
Back to top