Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestFirstOrCreateRowsAffected (0.14 sec)

  1. tests/create_test.go

    	var user *User
    
    	err := DB.Create(user).Error
    	if err == nil || err != gorm.ErrInvalidValue {
    		t.Fatalf("it is not ErrInvalidValue")
    	}
    }
    
    func TestFirstOrCreateRowsAffected(t *testing.T) {
    	user := User{Name: "TestFirstOrCreateRowsAffected"}
    
    	res := DB.FirstOrCreate(&user, "name = ?", user.Name)
    	if res.Error != nil || res.RowsAffected != 1 {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Tue Mar 19 03:50:28 UTC 2024
    - 26.4K bytes
    - Viewed (0)
Back to top