Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,711 for Find (0.13 sec)

  1. tests/upsert_test.go

    	}
    
    	DB.Where(&User{Name: "find or init"}).Assign("age", 44).FirstOrInit(&user4)
    	if user4.Name != "find or init" || user4.ID != 0 || user4.Age != 44 {
    		t.Errorf("user should be initialized with search value and assign attrs")
    	}
    
    	DB.Save(&User{Name: "find or init", Age: 33})
    	DB.Where(&User{Name: "find or init"}).Attrs("age", 44).FirstOrInit(&user5)
    	if user5.Name != "find or init" || user5.ID == 0 || user5.Age != 33 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/internal/connection/FastFallbackExchangeFinderTest.kt

        val plan1 = routePlanner.addPlan()
        plan1.connectState = TLS_CONNECTED
    
        taskRunner.newQueue().execute("connect") {
          val result0 = finder.find()
          assertThat(result0).isEqualTo(plan0.connection)
          val result1 = finder.find()
          assertThat(result1).isEqualTo(plan1.connection)
        }
    
        taskFaker.runTasks()
        assertEvents(
          "take plan 0",
          "take plan 1",
        )
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 24 04:40:49 GMT 2024
    - 20.9K bytes
    - Viewed (0)
  3. tests/transaction_test.go

    	if err := DB.First(&User{}, "name = ?", user.Name).Error; err != nil {
    		t.Fatalf("Should find saved record")
    	}
    
    	if err := DB.First(&User{}, "name = ?", user1.Name).Error; err == nil {
    		t.Fatalf("Should not find rollbacked record")
    	}
    
    	if err := DB.First(&User{}, "name = ?", user2.Name).Error; err != nil {
    		t.Fatalf("Should find saved record")
    	}
    }
    
    func TestNestedTransactionWithBlock(t *testing.T) {
    	var (
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  4. chainable_api.go

    // [docs] for more depth.
    //
    //	// add a simple limit clause
    //	db.Clauses(clause.Limit{Limit: 1}).Find(&User{})
    //	// tell the optimizer to use the `idx_user_name` index
    //	db.Clauses(hints.UseIndex("idx_user_name")).Find(&User{})
    //	// specify the lock strength to UPDATE
    //	db.Clauses(clause.Locking{Strength: "UPDATE"}).Find(&users)
    //
    // [docs]: https://gorm.io/docs/sql_builder.html#Clauses
    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)
  5. tests/associations_has_many_test.go

    	}
    
    	CheckUser(t, user, user)
    
    	// Find
    	var user2 User
    	DB.Find(&user2, "id = ?", user.ID)
    	DB.Model(&user2).Association("Pets").Find(&user2.Pets)
    	CheckUser(t, user2, user)
    
    	var pets []Pet
    	DB.Model(&user).Where("name = ?", user.Pets[0].Name).Association("Pets").Find(&pets)
    
    	if len(pets) != 1 {
    		t.Fatalf("should only find one pets, but got %v", len(pets))
    	}
    
    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)
  6. tests/table_test.go

    func TestTable(t *testing.T) {
    	dryDB := DB.Session(&gorm.Session{DryRun: true})
    
    	r := dryDB.Table("`user`").Find(&User{}).Statement
    	if !regexp.MustCompile("SELECT \\* FROM `user`").MatchString(r.Statement.SQL.String()) {
    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("user as u").Select("name").Find(&User{}).Statement
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  7. tests/multi_primary_keys_test.go

    	var tags []Tag
    	DB.Model(&blog).Association("SharedTags").Find(&tags)
    	if !compareTags(tags, []string{"tag1", "tag2", "tag3"}) {
    		t.Fatalf("Should find 3 tags")
    	}
    
    	DB.Model(&blog2).Association("SharedTags").Find(&tags)
    	if !compareTags(tags, []string{"tag1", "tag2", "tag3"}) {
    		t.Fatalf("Should find 3 tags")
    	}
    
    	var blog1 Blog
    	DB.Preload("SharedTags").Find(&blog1)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
  8. tests/joins_test.go

    	if len(users1) != 3 {
    		t.Errorf("should find two users using left join, but got %v", len(users1))
    	}
    
    	var users2 []User
    	DB.Joins("inner join pets on pets.user_id = users.id AND pets.name = ?", user.Pets[0].Name).Where("users.name = ?", user.Name).First(&users2)
    	if len(users2) != 1 {
    		t.Errorf("should find one users using left join with conditions, but got %v", len(users2))
    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)
  9. tests/associations_test.go

    		t.Fatalf("invalid %v count %v, expects: %v got %v", name, reason, result, count)
    	}
    
    	var newUser User
    	if user, ok := data.(User); ok {
    		DB.Find(&newUser, "id = ?", user.ID)
    	} else if user, ok := data.(*User); ok {
    		DB.Find(&newUser, "id = ?", user.ID)
    	}
    
    	if newUser.ID != 0 {
    		if count := DB.Model(&newUser).Association(name).Count(); count != result {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  10. tests/preload_test.go

    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	var user2 User
    	DB.Preload("Pets.Toy").Find(&user2, "id = ?", user.ID)
    	CheckUser(t, user2, user)
    
    	var user3 User
    	DB.Preload(clause.Associations+"."+clause.Associations).Find(&user3, "id = ?", user.ID)
    	CheckUser(t, user3, user)
    
    	var user4 *User
    	DB.Preload("Pets.Toy").Find(&user4, "id = ?", user.ID)
    	CheckUser(t, *user4, user)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
Back to top