Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for join (0.13 sec)

  1. tests/joins_test.go

    		Language
    		Pet
    	}
    
    	results := make([]Result, 0, 1)
    	DB.Select("users.*, user_speaks.*,  languages.*, pets.*").Table("users").Joins("JOIN user_speaks ON user_speaks.user_id = users.id").
    		Joins("JOIN languages ON languages.code = user_speaks.language_code").
    		Joins("LEFT OUTER JOIN pets ON pets.user_id = users.id").Find(&results)
    
    	if len(results) == 0 {
    		t.Fatalf("no record find")
    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. schema/constraint.go

    			names := strings.Split(chk, ",")
    			if len(names) > 1 && regEnLetterAndMidline.MatchString(names[0]) {
    				checks[names[0]] = CheckConstraint{Name: names[0], Constraint: strings.Join(names[1:], ","), Field: field}
    			} else {
    				if names[0] == "" {
    					chk = strings.Join(names[1:], ",")
    				}
    				name := schema.namer.CheckerName(schema.Table, field.DBName)
    				checks[name] = CheckConstraint{Name: name, Constraint: chk, Field: field}
    			}
    		}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 07:33:54 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  3. tests/count_test.go

    		t.Fatalf("Build count with select, but got %v", result.Statement.SQL.String())
    	}
    
    	var count4 int64
    	if err := DB.Table("users").Joins("LEFT JOIN companies on companies.name = users.name").Where("users.name = ?", user1.Name).Count(&count4).Error; err != nil || count4 != 1 {
    		t.Errorf("count with join, got error: %v, count %v", err, count4)
    	}
    
    	var count5 int64
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  4. clause/joins.go

    	RightJoin JoinType = "RIGHT"
    )
    
    // Join clause for from
    type Join struct {
    	Type       JoinType
    	Table      Table
    	ON         Where
    	Using      []string
    	Expression Expression
    }
    
    func (join Join) Build(builder Builder) {
    	if join.Expression != nil {
    		join.Expression.Build(builder)
    	} else {
    		if join.Type != "" {
    			builder.WriteString(string(join.Type))
    			builder.WriteByte(' ')
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Nov 03 13:03:13 GMT 2022
    - 901 bytes
    - Viewed (0)
  5. clause/joins_test.go

    			name: "RIGHT JOIN",
    			join: clause.Join{
    				Type:  clause.RightJoin,
    				Table: clause.Table{Name: "user"},
    				ON: clause.Where{
    					Exprs: []clause.Expression{clause.Eq{clause.Column{Table: "user_info", Name: "user_id"}, clause.PrimaryColumn}},
    				},
    			},
    			sql: "RIGHT JOIN `user` ON `user_info`.`user_id` = `users`.`id`",
    		},
    		{
    			name: "INNER JOIN",
    			join: clause.Join{
    				Type:  clause.InnerJoin,
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Nov 03 13:03:13 GMT 2022
    - 2.6K bytes
    - Viewed (0)
  6. 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)
  7. clause/from.go

    	}
    
    	for _, join := range from.Joins {
    		builder.WriteByte(' ')
    		join.Build(builder)
    	}
    }
    
    // MergeClause merge from clause
    func (from From) MergeClause(clause *Clause) {
    	clause.Expression = from
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 630 bytes
    - Viewed (0)
  8. 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)
  9. tests/distinct_test.go

    	}
    
    	dryDB := DB.Session(&gorm.Session{DryRun: true})
    	r := dryDB.Distinct("u.id, u.*").Table("user_speaks as s").Joins("inner join users as u on u.id = s.user_id").Where("s.language_code ='US' or s.language_code ='ES'").Find(&User{})
    	if !regexp.MustCompile(`SELECT DISTINCT u\.id, u\.\* FROM user_speaks as s inner join users as u`).MatchString(r.Statement.SQL.String()) {
    		t.Fatalf("Build Distinct with u.*, but got %v", r.Statement.SQL.String())
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2.5K bytes
    - Viewed (0)
  10. schema/naming_test.go

    	}
    
    	joinTable := ns.JoinTableName("user_languages")
    	if joinTable != "public.user_languages" {
    		t.Errorf("invalid join table generated, got %v", joinTable)
    	}
    
    	joinTable2 := ns.JoinTableName("UserLanguage")
    	if joinTable2 != "public.user_language" {
    		t.Errorf("invalid join table generated, got %v", joinTable2)
    	}
    
    	tableName := ns.TableName("Company")
    	if tableName != "public.company" {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue May 30 02:00:48 GMT 2023
    - 7K bytes
    - Viewed (0)
Back to top