Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for Join (0.14 sec)

  1. tests/joins_test.go

    	}
    
    	var users3 []User
    	DB.Joins("inner join pets on pets.user_id = users.id AND pets.name = ?", user.Pets[0].Name).Joins("join accounts on accounts.user_id = users.id AND accounts.number = ?", user.Account.Number).Where("users.name = ?", user.Name).First(&users3)
    	if len(users3) != 1 {
    		t.Errorf("should find one users using multiple left join conditions, but got %v", len(users3))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  2. callbacks/query.go

    							}
    						}
    					} else {
    						fromClause.Joins = append(fromClause.Joins, clause.Join{
    							Expression: clause.NamedExpr{SQL: join.Name, Vars: join.Conds},
    						})
    					}
    				} else {
    					fromClause.Joins = append(fromClause.Joins, clause.Join{
    						Expression: clause.NamedExpr{SQL: join.Name, Vars: join.Conds},
    					})
    				}
    			}
    
    			db.Statement.AddClause(fromClause)
    		} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  3. scan.go

    			continue
    		}
    
    		if len(joinFields) == 0 || len(joinFields[idx]) == 0 {
    			db.AddError(field.Set(db.Statement.Context, reflectValue, values[idx]))
    		} else { // joinFields count is larger than 2 when using join
    			var isNilPtrValue bool
    			var relValue reflect.Value
    			// does not contain raw dbname
    			nestedJoinSchemas := joinFields[idx][:len(joinFields[idx])-1]
    			// current reflect value
    			currentReflectValue := reflectValue
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  4. chainable_api.go

    		tx.Statement.AddClause(clause.Where{Exprs: []clause.Expression{clause.Or(clause.And(conds...))}})
    	}
    	return
    }
    
    // Joins specify Joins conditions
    //
    //	db.Joins("Account").Find(&user)
    //	db.Joins("JOIN emails ON emails.user_id = users.id AND emails.email = ?", "******@****.***").Find(&user)
    //	db.Joins("Account", DB.Select("id").Where("user_id = users.id AND name = ?", "someName").Model(&Account{}))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  5. migrator/migrator.go

    				}
    
    				if rel.Type == schema.HasOne || rel.Type == schema.HasMany {
    					beDependedOn[rel.FieldSchema] = true
    				}
    
    				if rel.JoinTable != nil {
    					// append join value
    					defer func(rel *schema.Relationship, joinValue interface{}) {
    						if !beDependedOn[rel.FieldSchema] {
    							dep.Depends = append(dep.Depends, rel.FieldSchema)
    						} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  6. tests/preload_test.go

    	value1 := Value{
    		Name: "value",
    		Nested: Nested{
    			Preloads: []*Preload{
    				{Value: "p1"}, {Value: "p2"},
    			},
    			Join: Join{Value: "j1"},
    		},
    	}
    	value2 := Value{
    		Name: "value2",
    		Nested: Nested{
    			Preloads: []*Preload{
    				{Value: "p3"}, {Value: "p4"}, {Value: "p5"},
    			},
    			Join: Join{Value: "j2"},
    		},
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  7. callbacks/preload.go

    	}
    	sort.Strings(preloadNames)
    
    	isJoined := func(name string) (joined bool, nestedJoins []string) {
    		for _, join := range joins {
    			if _, ok := relationships.Relations[join]; ok && name == join {
    				joined = true
    				continue
    			}
    			joinNames := strings.SplitN(join, ".", 2)
    			if len(joinNames) == 2 {
    				if _, ok := relationships.Relations[joinNames[0]]; ok && name == joinNames[0] {
    					joined = true
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  8. statement.go

    	Clauses              map[string]clause.Clause
    	BuildClauses         []string
    	Distinct             bool
    	Selects              []string // selected columns
    	Omits                []string // omit columns
    	Joins                []join
    	Preloads             map[string][]interface{}
    	Settings             sync.Map
    	ConnPool             ConnPool
    	Schema               *schema.Schema
    	Context              context.Context
    	RaiseErrorOnNotFound bool
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  9. tests/sql_builder_test.go

    								},
    							},
    						},
    					},
    				},
    			},
    		},
    	)
    
    	newDB.Joins("inner join rgs on rgs.id = user.id")
    
    	stmt := newDB.First(&result).Statement
    	str := stmt.SQL.String()
    
    	if !strings.Contains(str, "rgs.id = user.id") {
    		t.Errorf("The second join condition is over written instead of combining")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  10. gorm.go

    }
    
    // Expr returns clause.Expr, which can be used to pass SQL expression as params
    func Expr(expr string, args ...interface{}) clause.Expr {
    	return clause.Expr{SQL: expr, Vars: args}
    }
    
    // SetupJoinTable setup join table schema
    func (db *DB) SetupJoinTable(model interface{}, field string, joinTable interface{}) error {
    	var (
    		tx                      = db.getInstance()
    		stmt                    = tx.Statement
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
Back to top