Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for JoinTable (0.09 sec)

  1. schema/schema_helper_test.go

    				}
    			}
    
    			if r.JoinTable != nil {
    				if r.JoinTable.Name != relation.JoinTable.Name {
    					t.Errorf("schema %v relation's join table name expects %v, but got %v", s, relation.JoinTable.Name, r.JoinTable.Name)
    				}
    
    				if r.JoinTable.Table != relation.JoinTable.Table {
    					t.Errorf("schema %v relation's join table tablename expects %v, but got %v", s, relation.JoinTable.Table, r.JoinTable.Table)
    				}
    
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Thu Aug 28 02:57:17 UTC 2025
    - 7.5K bytes
    - Viewed (0)
  2. schema/relationship.go

    		Tag:  `gorm:"-"`,
    	})
    
    	if relation.JoinTable, err = Parse(reflect.New(reflect.StructOf(joinTableFields)).Interface(), schema.cacheStore,
    		schema.namer); err != nil {
    		schema.err = err
    	}
    	relation.JoinTable.Name = many2many
    	relation.JoinTable.Table = schema.namer.JoinTableName(many2many)
    	relation.JoinTable.PrimaryFields = make([]*Field, 0, len(relation.JoinTable.Fields))
    
    	relName := relation.Schema.Name
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Mon Aug 18 11:44:52 UTC 2025
    - 23.1K bytes
    - Viewed (1)
  3. schema/relationship_test.go

    		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",
    		JoinTable: JoinTable{Name: "user_profiles2", Table: "user_profiles2"},
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Mon Aug 18 11:44:52 UTC 2025
    - 26.5K bytes
    - Viewed (0)
  4. tests/generics_test.go

    	}
    
    	// Left JOIN + Alias WHERE
    	result, err = db.Joins(clause.LeftJoin.Association("Company").As("t"), func(db gorm.JoinBuilder, joinTable clause.Table, curTable clause.Table) error {
    		if joinTable.Name != "t" {
    			t.Fatalf("Join table should be t, but got %v", joinTable.Name)
    		}
    		db.Where("?.name = ?", joinTable, u.Company.Name)
    		return nil
    	}).Where(map[string]any{"name": u.Name}).First(ctx)
    	if err != nil {
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Thu Sep 04 13:13:16 UTC 2025
    - 28K bytes
    - Viewed (0)
  5. callbacks/delete.go

    					foreignFields  = make([]*schema.Field, 0, len(rel.References))
    					relForeignKeys = make([]string, 0, len(rel.References))
    					modelValue     = reflect.New(rel.JoinTable.ModelType).Interface()
    					table          = rel.JoinTable.Table
    					tx             = db.Session(&gorm.Session{NewDB: true}).Model(modelValue).Table(table)
    				)
    
    				for _, ref := range rel.References {
    					if ref.OwnPrimaryKey {
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Sun May 25 07:40:40 UTC 2025
    - 5.8K bytes
    - Viewed (0)
  6. gorm.go

    func (db *DB) SetupJoinTable(model interface{}, field string, joinTable interface{}) error {
    	var (
    		tx                      = db.getInstance()
    		stmt                    = tx.Statement
    		modelSchema, joinSchema *schema.Schema
    	)
    
    	err := stmt.Parse(model)
    	if err != nil {
    		return err
    	}
    	modelSchema = stmt.Schema
    
    	err = stmt.Parse(joinTable)
    	if err != nil {
    		return err
    	}
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Tue Aug 26 06:24:29 UTC 2025
    - 12.8K bytes
    - Viewed (0)
  7. schema/schema_test.go

    			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{
    				{
    					Name: "UserID", DBName: "user_id", BindNames: []string{"UserID"}, DataType: schema.Uint,
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Thu Aug 28 02:57:17 UTC 2025
    - 13.3K bytes
    - Viewed (0)
  8. generics.go

    	q.limitPerRecord = num
    	return q
    }
    
    func (c chainG[T]) Joins(jt clause.JoinTarget, on func(db JoinBuilder, joinTable clause.Table, curTable clause.Table) error) ChainInterface[T] {
    	return c.with(func(db *DB) *DB {
    		if jt.Table == "" {
    			jt.Table = clause.JoinTable(strings.Split(jt.Association, ".")...).Name
    		}
    
    		q := joinBuilder{db: db.Session(&Session{NewDB: true, Initialized: true}).Table(jt.Table)}
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Thu Sep 04 13:13:16 UTC 2025
    - 15.5K bytes
    - Viewed (0)
  9. clause/joins.go

    	jt.Table = name
    	return jt
    }
    
    // Join clause for from
    type Join struct {
    	Type       JoinType
    	Table      Table
    	ON         Where
    	Using      []string
    	Expression Expression
    }
    
    func JoinTable(names ...string) Table {
    	return Table{
    		Name: utils.JoinNestedRelationNames(names),
    	}
    }
    
    func (join Join) Build(builder Builder) {
    	if join.Expression != nil {
    		join.Expression.Build(builder)
    	} else {
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Sun May 25 07:40:40 UTC 2025
    - 1.5K bytes
    - Viewed (0)
  10. callbacks/preload.go

    		relForeignFields []*schema.Field
    		foreignFields    []*schema.Field
    		foreignValues    [][]interface{}
    		identityMap      = map[string][]reflect.Value{}
    		inlineConds      []interface{}
    	)
    
    	if rel.JoinTable != nil {
    		var (
    			joinForeignFields    = make([]*schema.Field, 0, len(rel.References))
    			joinRelForeignFields = make([]*schema.Field, 0, len(rel.References))
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Sun May 25 07:40:40 UTC 2025
    - 11.7K bytes
    - Viewed (0)
Back to top