Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for cout (0.18 sec)

  1. tests/non_std_test.go

    		t.Errorf("UpdatedAt should be updated")
    	}
    
    	var animals []Animal
    	DB.Find(&animals)
    	if count := DB.Model(Animal{}).Where("1=1").Update("CreatedAt", time.Now().Add(2*time.Hour)).RowsAffected; count != int64(len(animals)) {
    		t.Error("RowsAffected should be correct when do batch update")
    	}
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  2. 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)
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 22.7K bytes
    - Viewed (0)
  3. tests/sql_builder_test.go

    	if err != nil {
    		t.Errorf("Not error should happen, got %v", err)
    	}
    
    	count := 0
    	for rows.Next() {
    		var name string
    		var age int64
    		rows.Scan(&name, &age)
    		count++
    	}
    
    	if count != 2 {
    		t.Errorf("Should found two records")
    	}
    }
    
    func TestRaw(t *testing.T) {
    	user1 := User{Name: "ExecRawSqlUser1", Age: 1}
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  4. utils/utils_test.go

    		elems []string
    		elem  string
    		out   bool
    	}{
    		{"exists", []string{"1", "2", "3"}, "1", true},
    		{"not exists", []string{"1", "2", "3"}, "4", false},
    	}
    	for _, test := range containsTests {
    		t.Run(test.name, func(t *testing.T) {
    			if out := Contains(test.elems, test.elem); test.out != out {
    				t.Errorf("Contains(%v, %s) want: %t, got: %t", test.elems, test.elem, test.out, out)
    			}
    		})
    	}
    }
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Feb 19 03:42:25 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  5. 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
    }
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Apr 26 07:15:49 UTC 2024
    - 29K bytes
    - Viewed (0)
  6. tests/query_test.go

    	}
    
    	if totalBatch != 6 {
    		t.Errorf("incorrect total batch, expects: %v, got %v", 6, totalBatch)
    	}
    
    	var count int64
    	DB.Model(&User{}).Where("name = ?", "find_in_batches_new").Count(&count)
    	if count != 6 {
    		t.Errorf("incorrect count after update, expects: %v, got %v", 6, count)
    	}
    }
    
    func TestFindInBatchesWithOffsetLimit(t *testing.T) {
    	users := []User{
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 49.8K bytes
    - Viewed (0)
  7. 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,
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 09:47:34 UTC 2024
    - 14.5K bytes
    - Viewed (0)
  8. association.go

    	return association.Error
    }
    
    func (association *Association) Clear() error {
    	return association.Replace()
    }
    
    func (association *Association) Count() (count int64) {
    	if association.Error == nil {
    		association.Error = association.buildCondition().Count(&count).Error
    	}
    	return
    }
    
    type assignBack struct {
    	Source reflect.Value
    	Index  int
    	Dest   reflect.Value
    }
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 21.5K bytes
    - Viewed (0)
  9. 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, "")
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 16K bytes
    - Viewed (0)
  10. tests/associations_has_one_test.go

    		*GetUser("slice-hasone-3", Config{Account: true}),
    	}
    
    	DB.Create(&users)
    
    	// Count
    	AssertAssociationCount(t, users, "Account", 2, "")
    
    	// Find
    	var accounts []Account
    	if DB.Model(&users).Association("Account").Find(&accounts); len(accounts) != 2 {
    		t.Errorf("accounts count should be %v, but got %v", 3, len(accounts))
    	}
    
    	// Append
    	DB.Model(&users).Association("Account").Append(
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 7.1K bytes
    - Viewed (0)
Back to top