- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 27 for courant (0.19 sec)
-
tests/count_test.go
if count != int64(len(users)) { t.Errorf("Count() method should get correct value, expect: %v, got %v", count, len(users)) } if err := DB.Model(&User{}).Where("name = ?", user1.Name).Or("name = ?", user3.Name).Count(&count).Find(&users).Error; err != nil { t.Errorf(fmt.Sprintf("Count should work, but got err %v", err)) } if count != int64(len(users)) {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Oct 30 09:15:49 GMT 2023 - 6.9K bytes - Viewed (0) -
tests/soft_delete_test.go
t.Errorf("Should find soft deleted record with Unscoped, but got err %s", err) } count = 0 if DB.Unscoped().Model(&User{}).Where("name = ?", user.Name).Count(&count).Error != nil || count != 1 { t.Errorf("Count soft deleted record, expects: %v, count: %v", 1, count) } age = 0 if DB.Unscoped().Model(&User{}).Select("age").Where("name = ?", user.Name).Scan(&age).Error != nil || age != user.Age {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Feb 01 06:40:55 GMT 2023 - 5.7K bytes - Viewed (0) -
tests/associations_has_many_test.go
CheckPet(t, pets[0], *user.Pets[0]) if count := DB.Model(&user).Where("name = ?", user.Pets[1].Name).Association("Pets").Count(); count != 1 { t.Fatalf("should only find one pets, but got %v", count) } if count := DB.Model(&user).Where("name = ?", "not found").Association("Pets").Count(); count != 0 { t.Fatalf("should only find no pet with invalid conditions, but got %v", count) } // Count AssertAssociationCount(t, user, "Pets", 2, "")
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Dec 15 08:36:08 GMT 2023 - 15.6K bytes - Viewed (0) -
scan.go
fields[idx] = field if count, ok := matchedFieldCount[column]; ok { // handle duplicate fields for _, selectField := range sch.Fields { if selectField.DBName == column && selectField.Readable { if count == 0 { matchedFieldCount[column]++ fields[idx] = selectField break } count-- } } } else {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 09:53:11 GMT 2024 - 9.8K bytes - Viewed (0) -
tests/joins_test.go
user := User{Name: "kingGo", CompanyID: &companyB.ID} DB.Create(&user) query := DB.Model(&User{}).Joins("Company") // Bug happens when .Count is called on a query. // Removing the below two lines or downgrading to gorm v1.20.12 will make this test pass. var total int64 query.Count(&total) var result User // Incorrectly generates a 'SELECT *' query which causes companies.id to overwrite users.id
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Apr 26 14:19:32 GMT 2023 - 13.5K bytes - Viewed (1) -
tests/distinct_test.go
} var count int64 if err := DB.Model(&User{}).Where("name like ?", "distinct%").Count(&count).Error; err != nil || count != 5 { t.Errorf("failed to query users count, got error: %v, count: %v", err, count) } if err := DB.Model(&User{}).Distinct("name").Where("name like ?", "distinct%").Count(&count).Error; err != nil || count != 3 { t.Errorf("failed to query users count, got error: %v, count %v", err, count) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 2.5K bytes - Viewed (0) -
migrator/migrator.go
func (m Migrator) HasTable(value interface{}) bool { var count int64 m.RunWithValue(value, func(stmt *gorm.Statement) error { currentDatabase := m.DB.Migrator().CurrentDatabase() return m.DB.Raw("SELECT count(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ? AND table_type = ?", currentDatabase, stmt.Table, "BASE TABLE").Row().Scan(&count) }) return count > 0 }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 07:15:49 GMT 2024 - 29K bytes - Viewed (0) -
schema/schema_helper_test.go
if len(relations.Relations) != len(rs.Relations) { t.Errorf("schema relations count don't match, expects %d, got %d", len(rs.Relations), len(relations.Relations)) } if len(relations.EmbeddedRelations) != len(rs.EmbeddedRelations) { t.Errorf("schema embedded relations count don't match, expects %d, got %d", len(rs.EmbeddedRelations), len(relations.EmbeddedRelations)) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Dec 15 08:31:23 GMT 2023 - 7.5K bytes - Viewed (0) -
chainable_api.go
clause.Expression = nil tx.Statement.Clauses["SELECT"] = clause } case string: if strings.Count(v, "?") >= len(args) && len(args) > 0 { tx.Statement.AddClause(clause.Select{ Distinct: db.Statement.Distinct, Expression: clause.Expr{SQL: v, Vars: args}, }) } else if strings.Count(v, "@") > 0 && len(args) > 0 { tx.Statement.AddClause(clause.Select{ Distinct: db.Statement.Distinct,
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Apr 17 03:38:55 GMT 2024 - 14.3K bytes - Viewed (1) -
finisher_api.go
} if len(tx.Statement.Selects) == 0 { tx.Statement.AddClause(clause.Select{Expression: clause.Expr{SQL: "count(*)"}}) } else if !strings.HasPrefix(strings.TrimSpace(strings.ToLower(tx.Statement.Selects[0])), "count(") { expr := clause.Expr{SQL: "count(*)"} if len(tx.Statement.Selects) == 1 { dbName := tx.Statement.Selects[0] fields := strings.FieldsFunc(dbName, utils.IsValidDBNameChar)
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 22.7K bytes - Viewed (0)