- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 23 for County (0.19 sec)
-
tests/count_test.go
if count1 != 1 || count2 != 3 { t.Errorf("multiple count in chain should works") } tx := DB.Model(&User{}).Where("name = ?", user1.Name).Session(&gorm.Session{}) tx.Count(&count1) tx.Or("name in ?", []string{user2.Name, user3.Name}).Count(&count2) if count1 != 1 || count2 != 3 { t.Errorf("count after new session should works")
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/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) -
tests/main_test.go
t.Errorf("Should got error with invalid SQL") } var count1, count2 int64 DB.Model(&User{}).Count(&count1) if count1 <= 0 { t.Errorf("Should find some users") } if DB.Where("name = ?", "jinzhu; delete * from users").First(&User{}).Error == nil { t.Errorf("Should got error with invalid SQL") } DB.Model(&User{}).Count(&count2) if count1 != count2 { t.Errorf("No user should not be deleted by invalid SQL") }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Mar 24 01:31:58 GMT 2022 - 1.4K bytes - Viewed (0) -
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) -
errors.go
ErrInvalidValueOfLength = errors.New("invalid association values, length doesn't match") // ErrPreloadNotAllowed preload is not allowed when count is used ErrPreloadNotAllowed = errors.New("preload is not allowed when count is used") // ErrDuplicatedKey occurs when there is a unique key constraint violation ErrDuplicatedKey = errors.New("duplicated key not allowed")
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 02:53:17 GMT 2024 - 2.5K bytes - Viewed (0) -
tests/customize_field_test.go
} DB.Migrator().DropTable(&CustomizeColumn{}) DB.AutoMigrate(&CustomizeColumn{}) expected := "foo" now := time.Now() cc := CustomizeColumn{ID: 666, Name: expected, Date: &now} if count := DB.Create(&cc).RowsAffected; count != 1 { t.Error("There should be one record be affected when create record") } var cc1 CustomizeColumn DB.First(&cc1, "mapped_name = ?", "foo") if cc1.Name != expected {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Sep 11 09:33:31 GMT 2020 - 6.9K bytes - Viewed (0) -
tests/migrate_test.go
if err := DB.Migrator().CreateView("users_pets", gorm.ViewOption{Query: query}); err != nil { t.Fatalf("Failed to crate view, got %v", err) } var count int64 if err := DB.Table("users_pets").Count(&count).Error; err != nil { t.Fatalf("should found created view") } if err := DB.Migrator().DropView("users_pets"); err != nil { t.Fatalf("Failed to drop view, got %v", err) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Mar 18 11:24:16 GMT 2024 - 56.2K bytes - Viewed (0)