- Sort Score
- Result 10 results
- Languages All
Results 861 - 870 of 880 for assertEquals (0.11 sec)
-
tests/associations_test.go
err = DB.Model(&emptyUser).Association("Company").Delete(&user1.Company) AssertEqual(t, err, gorm.ErrPrimaryKeyRequired) // has many err = DB.Model(&emptyUser).Association("Pets").Delete(&user1.Pets) AssertEqual(t, err, gorm.ErrPrimaryKeyRequired) // has one err = DB.Model(&emptyUser).Association("Account").Delete(&user1.Account) AssertEqual(t, err, gorm.ErrPrimaryKeyRequired) // many to many
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 08 08:29:09 UTC 2023 - 10.9K bytes - Viewed (0) -
tests/update_test.go
} var result Language DB.First(&result, "code = ?", "save") AssertEqual(t, result, lang) lang.Name = "save name2" if result := DB.Save(&lang); result.RowsAffected != 1 { t.Errorf("should update language") } var result2 Language DB.First(&result2, "code = ?", "save") AssertEqual(t, result2, lang) DB.Table("langs").Migrator().DropTable(&Language{})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0) -
tests/prepared_stmt_test.go
tx.First(&result) wg.Done() }() } wg.Wait() conn, ok := tx.ConnPool.(*gorm.PreparedStmtDB) AssertEqual(t, ok, true) AssertEqual(t, len(conn.Stmts), 2) for _, stmt := range conn.Stmts { if stmt == nil { t.Fatalf("stmt cannot bee nil") } } AssertEqual(t, sqlDB.Stats().InUse, 0) } func TestPreparedStmtInTransaction(t *testing.T) { user := User{Name: "jinzhu"}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 22 11:02:05 UTC 2024 - 8.5K bytes - Viewed (0) -
statement.go
if mv, mok := stmt.Dest.(map[string]interface{}); mok { if fv, ok := mv[field.Name]; ok { return !utils.AssertEqual(fv, fieldValue) } else if fv, ok := mv[field.DBName]; ok { return !utils.AssertEqual(fv, fieldValue) } } else { destValue := reflect.ValueOf(stmt.Dest) for destValue.Kind() == reflect.Ptr { destValue = destValue.Elem() }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 19.9K bytes - Viewed (0) -
tests/query_test.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 50.4K bytes - Viewed (0) -
utils/utils_test.go
{"driver.Valuer equal (ptr to nil ptr)", (*ModifyAt)(nil), &ModifyAt{}, false}, } for _, test := range assertEqualTests { t.Run(test.name, func(t *testing.T) { if out := AssertEqual(test.src, test.dst); test.out != out { t.Errorf("AssertEqual(%v, %v) want: %t, got: %t", test.src, test.dst, test.out, out) } }) } } func TestToString(t *testing.T) { tests := []struct { name string
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 22 11:03:42 UTC 2024 - 4.9K bytes - Viewed (0) -
tests/scan_test.go
} personDupField := Person{ID: person1.ID} if err := DB.Select("people.id, people.*"). First(&personDupField).Error; err != nil { t.Errorf("Failed to run join query, got error: %v", err) } AssertEqual(t, person1, personDupField) user := User{ Name: "TestScanToEmbedded_1", Manager: &User{ Name: "TestScanToEmbedded_1_m1", Manager: &User{Name: "TestScanToEmbedded_1_m1_m1"}, }, }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:57:36 UTC 2024 - 10.9K bytes - Viewed (0) -
tests/count_test.go
} expects := []User{{Name: "main"}, {Name: "other"}, {Name: "other"}} sort.SliceStable(users, func(i, j int) bool { return strings.Compare(users[i].Name, users[j].Name) < 0 }) AssertEqual(t, users, expects) var count7 int64 if err := DB.Model(&User{}).Where("name in ?", []string{user1.Name, user2.Name, user3.Name}).Select( "(CASE WHEN name=? THEN ? ELSE ? END) as name, age", "count-1", "main", "other",
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 6.9K bytes - Viewed (0) -
tests/upsert_test.go
} else { AssertEqual(t, result, lang) } lang.Name += "_new" if err := DB.Save(&lang).Error; err != nil { t.Errorf("Failed to create, got error %v", err) } var result2 Language if err := DB.First(&result2, "code = ?", lang.Code).Error; err != nil { t.Errorf("Failed to query lang, got error %v", err) } else { AssertEqual(t, result2, lang) } }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Sep 05 07:39:19 UTC 2022 - 11.4K bytes - Viewed (0) -
tests/customize_field_test.go
var result4 CustomizeFieldStruct if err := DB.First(&result4, "field_allow_save3 = ?", create.FieldAllowSave3).Error; err != nil { t.Fatalf("failed to query with inserted field, got error %v", err) } AssertEqual(t, result3, result4) createWithDefaultTime := generateStruct("create_with_default_time") createWithDefaultTime.AutoUnixCreateTime = 100 createWithDefaultTime.AutoUnixUpdateTime = 100
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Sep 11 09:33:31 UTC 2020 - 6.9K bytes - Viewed (0)