- Sort Score
- Result 10 results
- Languages All
Results 1 - 1 of 1 for TestFirstOrCreateWithPrimaryKey (0.26 sec)
-
tests/create_test.go
company := Company{Name: "first_or_create_if_not_exists_table"} if err := DB.Table("not_exists").FirstOrCreate(&company).Error; err == nil { t.Errorf("not exists table, but err is nil") } } func TestFirstOrCreateWithPrimaryKey(t *testing.T) { company := Company{ID: 100, Name: "company100_with_primarykey"} DB.FirstOrCreate(&company) if company.ID != 100 { t.Errorf("invalid primary key after creating, got %v", company.ID)
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Tue Mar 19 03:50:28 GMT 2024 - 26.4K bytes - Viewed (0)