Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for many2many (0.64 sec)

  1. schema/relationship.go

    		schema.err = err
    		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: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 03:46:59 UTC 2024
    - 22.7K bytes
    - Viewed (0)
  2. 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: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 21.5K bytes
    - Viewed (0)
  3. callbacks/preload.go

    	fieldValues := make([]interface{}, len(relForeignFields))
    
    	// clean up old values before preloading
    	switch reflectValue.Kind() {
    	case reflect.Struct:
    		switch rel.Type {
    		case schema.HasMany, schema.Many2Many:
    			tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue, reflect.MakeSlice(rel.Field.IndirectFieldType, 0, 10).Interface()))
    		default:
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:52:33 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  4. 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: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Apr 15 03:20:20 UTC 2024
    - 25.5K bytes
    - Viewed (0)
  5. 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: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Apr 26 07:15:49 UTC 2024
    - 29K bytes
    - Viewed (0)
  6. 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 TestAutoMigrateInt8PG(t *testing.T) {
    	if DB.Dialector.Name() != "postgres" {
    		return
    	}
    
    	type Smallint int8
    
    	type MigrateInt struct {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Mar 18 11:24:16 UTC 2024
    - 56.2K bytes
    - Viewed (0)
Back to top