- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 77 for association (0.13 sec)
-
association.go
} } 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 {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun Oct 26 12:09:12 UTC 2025 - 23.6K bytes - Viewed (0) -
clause/association.go
type AssociationOpType int const ( OpUnlink AssociationOpType = iota // Unlink association OpDelete // Delete association records OpUpdate // Update association records OpCreate // Create association records with assignments ) // Association represents an association operation type Association struct {Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Fri Sep 12 05:42:26 UTC 2025 - 1.2K bytes - Viewed (0) -
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",
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Wed Jul 08 09:59:40 UTC 2020 - 4.2K bytes - Viewed (0) -
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 {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Fri Sep 12 04:33:27 UTC 2025 - 16.3K bytes - Viewed (0) -
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 {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Thu Sep 10 13:46:18 UTC 2020 - 3.5K bytes - Viewed (1) -
tests/associations_has_one_test.go
// Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Account").Find(&user2.Account) CheckUser(t, user2, user) // Count AssertAssociationCount(t, user, "Account", 1, "") // Append account := Account{Number: "account-has-one-append"} if err := DB.Model(&user2).Association("Account").Append(&account); err != nil { t.Fatalf("Error happened when append account, got %v", err)
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 7.1K bytes - Viewed (0) -
tests/association_generics_test.go
} // Test Set + Update with multiple association operations assocOp1 := clause.Association{ Association: "Pets", Type: clause.OpCreate, Set: []clause.Assignment{ {Column: clause.Column{Name: "name"}, Value: "test-pet-1"}, }, } assocOp2 := clause.Association{ Association: "Toys", Type: clause.OpCreate, Set: []clause.Assignment{Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Fri Sep 12 05:42:26 UTC 2025 - 37.9K bytes - Viewed (0) -
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 {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sat Jun 10 13:05:19 UTC 2023 - 13.2K bytes - Viewed (0) -
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
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Mon Jul 21 02:46:58 UTC 2025 - 13.1K bytes - Viewed (0) -
generics.go
data[a.Column.Name] = a.Value } return assoc.Append(data) }, op.Association) } return s.handleAssociationForOwners(base, ctx, func(owner T, assoc *Association) error { return assoc.Append(op.Values...) }, op.Association) } // handleAssociationForOwners is a helper function that handles associations for all owners
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun Nov 02 14:09:18 UTC 2025 - 25.9K bytes - Viewed (0)