Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 69 for association (0.21 sec)

  1. association.go

    		association.Error = err
    	}
    
    	return association
    }
    
    func (association *Association) Unscoped() *Association {
    	return &Association{
    		DB:           association.DB,
    		Relationship: association.Relationship,
    		Error:        association.Error,
    		Unscope:      true,
    	}
    }
    
    func (association *Association) Find(out interface{}, conds ...interface{}) error {
    	if association.Error == nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  2. tests/associations_many2many_test.go

    	DB.Find(&user2, "id = ?", user.ID)
    	DB.Model(&user2).Association("Languages").Find(&user2.Languages)
    
    	CheckUser(t, user2, user)
    
    	// Count
    	AssertAssociationCount(t, user, "Languages", 2, "")
    
    	// Append
    	language := Language{Code: "language-many2many-append", Name: "language-many2many-append"}
    	DB.Create(&language)
    
    	if err := DB.Model(&user2).Association("Languages").Append(&language); err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 13.2K bytes
    - Viewed (0)
  3. tests/associations_has_many_test.go

    	}
    
    	// test delete
    	if err := tx.Model(&item).Association("Contents").Unscoped().Delete(&contents[0]); err != nil {
    		t.Errorf("failed to delete Contents, got error: %v", err)
    	}
    	if count := tx.Model(&item).Association("Contents").Count(); count != 2 {
    		t.Errorf("expected %d contents, got %d", 2, count)
    	}
    
    	// test clear
    	if err := tx.Model(&item).Association("Contents").Unscoped().Clear(); err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  4. tests/delete_test.go

    	users := []User{
    		*GetUser("delete_slice_with_associations1", Config{Account: true, Pets: 4, Toys: 1, Company: true, Manager: true, Team: 1, Languages: 1, Friends: 4}),
    		*GetUser("delete_slice_with_associations2", Config{Account: true, Pets: 3, Toys: 2, Company: true, Manager: true, Team: 2, Languages: 2, Friends: 3}),
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 07:03:34 GMT 2023
    - 9.4K bytes
    - Viewed (0)
  5. tests/associations_belongs_to_test.go

    	// Clear
    	DB.Model(&users).Association("Company").Clear()
    	AssertAssociationCount(t, users, "Company", 0, "After Clear")
    
    	DB.Model(&users).Association("Manager").Clear()
    	AssertAssociationCount(t, users, "Manager", 0, "After Clear")
    
    	// shared company
    	company := Company{Name: "shared"}
    	if err := DB.Model(&users[0]).Association("Company").Append(&company); err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  6. tests/joins_table_test.go

    	}
    
    	if DB.Unscoped().Model(&person).Association("Addresses").Count() != 2 {
    		t.Fatalf("Should found soft deleted addresses with unscoped")
    	}
    
    	DB.Model(&person).Association("Addresses").Clear()
    
    	if DB.Model(&person).Association("Addresses").Count() != 0 {
    		t.Fatalf("Should deleted all addresses")
    	}
    
    	if DB.Unscoped().Model(&person).Association("Addresses").Count() != 2 {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Sep 10 13:46:18 GMT 2020
    - 3.5K bytes
    - Viewed (0)
  7. tests/associations_test.go

    	var emptyUser User
    	var err error
    	// belongs to
    	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)
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  8. tests/named_polymorphic_test.go

    		t.Errorf("Should find has one polymorphic association")
    	}
    
    	hamsterToy = Toy{}
    	DB.Model(&hamster).Association("OtherToy").Find(&hamsterToy)
    	if hamsterToy.Name != hamster.OtherToy.Name {
    		t.Errorf("Should find has one polymorphic association")
    	}
    
    	// Append
    	DB.Model(&hamster).Association("PreferredToy").Append(&Toy{
    		Name: "bike 2",
    	})
    
    	DB.Model(&hamster).Association("OtherToy").Append(&Toy{
    		Name: "treadmill 2",
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jul 08 09:59:40 GMT 2020
    - 4.2K bytes
    - Viewed (0)
  9. maven-compat/src/main/mdo/profiles.mdo

              <association>
                <type>Activation</type>
              </association>
            </field>
            <field>
              <name>properties</name>
              <description>Extended configuration specific to this profile goes
                here.</description>
              <type>Properties</type>
              <association xml.mapStyle="inline">
                <type>String</type>
    XML
    - Registered: Sun Apr 21 03:35:09 GMT 2024
    - Last Modified: Tue Jan 03 21:08:35 GMT 2023
    - 13.8K bytes
    - Viewed (0)
  10. tests/multi_primary_keys_test.go

    	var tags3 []Tag
    	DB.Model(&blog).Association("Tags").Find(&tags3)
    	if !compareTags(tags3, []string{"tag6"}) {
    		t.Fatalf("Should find 1 tags after Delete")
    	}
    
    	if DB.Model(&blog).Association("Tags").Count() != 1 {
    		t.Fatalf("Blog should has three tags after Delete")
    	}
    
    	DB.Model(&blog).Association("Tags").Delete(tag3)
    	var tags4 []Tag
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
Back to top