- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 10 for MANY2MANY (0.08 sec)
-
schema/relationship.go
return nil } if hasPolymorphicRelation(field.TagSettings) { schema.buildPolymorphicRelation(relation, field) } else if many2many := field.TagSettings["MANY2MANY"]; many2many != "" { schema.buildMany2ManyRelation(relation, field, many2many) } else if belongsTo := field.TagSettings["BELONGSTO"]; belongsTo != "" { schema.guessRelation(relation, field, guessBelongs) } else {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun Nov 16 04:11:05 UTC 2025 - 23.1K bytes - Viewed (1) -
schema/relationship_test.go
Name: "Profiles", Type: schema.Many2Many, Schema: "User", FieldSchema: "Profile", JoinTable: JoinTable{Name: "user_profiles", Table: "user_profiles"}, References: []Reference{ {"Refer", "User", "UserReferID", "user_profiles", "", true}, {"UserRefer", "Profile", "ProfileRefer", "user_profiles", "", false}, }, }, Relation{ Name: "Profiles2", Type: schema.Many2Many, Schema: "User", FieldSchema: "Profile",
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Mon Aug 18 11:44:52 UTC 2025 - 26.5K bytes - Viewed (0) -
association.go
} else { association.Error = tx.Where(clause.IN{Column: column, Values: values}).UpdateColumns(updateMap).Error } } case schema.Many2Many: var ( primaryFields, relPrimaryFields []*schema.Field joinPrimaryKeys, joinRelPrimaryKeys []string modelValue = reflect.New(rel.JoinTable.ModelType).Interface()Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun Oct 26 12:09:12 UTC 2025 - 23.6K bytes - Viewed (0) -
schema/schema_test.go
}, { Name: "Team", Type: schema.HasMany, Schema: "User", FieldSchema: "User", References: []Reference{{"ID", "User", "ManagerID", "User", "", true}}, }, { Name: "Languages", Type: schema.Many2Many, Schema: "User", FieldSchema: "Language", JoinTable: JoinTable{Name: "UserSpeak", Table: "user_speaks", Fields: []schema.Field{ {Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Thu Aug 28 02:57:17 UTC 2025 - 13.3K bytes - Viewed (0) -
tests/multi_primary_keys_test.go
t.Fatalf("Should find 3 tags") } var blog1 Blog DB.Preload("Tags").Find(&blog1) if !compareTags(blog1.Tags, []string{"tag1", "tag2", "tag3"}) { t.Fatalf("Preload many2many relations") } // Replace tag5 := &Tag{Locale: "ZH", Value: "tag5"} tag6 := &Tag{Locale: "ZH", Value: "tag6"} DB.Model(&blog).Association("Tags").Replace(tag5, tag6) var tags2 []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) -
tests/association_generics_test.go
} if rows, err := gorm.G[User](DB).Where("id = ?", user.ID).Set(assocOp).Update(ctx); err != nil { t.Fatalf("Set Update many2many create with set failed: %v", err) } else if rows != 0 { t.Fatalf("expected 0 rows affected, got %d", rows) } AssertAssociationCount(t, user, "Languages", 1, "after create language") }
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_test.go
if err != nil { t.Fatalf("Failed to find, got error: %v", err) } AssertEqual(t, result, user) } // Ensure Association.Append/Replace supports map for many2many func TestAssociationMany2ManyAppendMap(t *testing.T) { user := *GetUser("assoc_m2m_append_map", Config{}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("create user: %v", err) }Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Fri Sep 12 04:33:27 UTC 2025 - 13.3K bytes - Viewed (0) -
generics.go
} else { db.AddError(fmt.Errorf("relation %s not found", association)) return nil } } if q.limitPerRecord > 0 { if relation.JoinTable != nil { tx.AddError(fmt.Errorf("many2many relation %s don't support LimitPerRecord", association)) return tx } refColumns := []clause.Column{} for _, rel := range relation.References { if rel.OwnPrimaryKey {Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun Nov 02 14:09:18 UTC 2025 - 25.9K bytes - Viewed (0) -
migrator/migrator.go
return &uni, stmt.Table } getTable := func(rel *schema.Relationship) string { switch rel.Type { case schema.HasOne, schema.HasMany: return rel.FieldSchema.Table case schema.Many2Many: return rel.JoinTable.Table } return stmt.Table } for _, rel := range stmt.Schema.Relationships.Relations { if constraint := rel.ParseConstraint(); constraint != nil && constraint.Name == name {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun Oct 26 12:31:09 UTC 2025 - 29.7K bytes - Viewed (0) -
tests/migrate_test.go
{"accounts", "fk_users_account"}, {"users", "fk_users_team"}, {"users", "fk_users_company"}, } { if !DB.Migrator().HasConstraint(indexes[0], indexes[1]) { t.Fatalf("Failed to find index for many2many for %v %v", indexes[0], indexes[1]) } } } func TestAutoMigrateInt8PGAndGaussDB(t *testing.T) { if DB.Dialector.Name() != "postgres" && DB.Dialector.Name() != "gaussdb" { return }Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Wed Aug 20 04:51:17 UTC 2025 - 65.2K bytes - Viewed (0)