Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for Join (0.16 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. 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_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)
  5. 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)
  6. 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)
  7. 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)
  8. clause/from_test.go

    					Tables: []clause.Table{{Name: "users"}},
    					Joins: []clause.Join{
    						{
    							Type:  clause.InnerJoin,
    							Table: clause.Table{Name: "articles"},
    							ON: clause.Where{
    								[]clause.Expression{clause.Eq{clause.Column{Table: "articles", Name: "id"}, clause.PrimaryColumn}},
    							},
    						},
    					},
    				},
    			},
    			"SELECT * FROM `users` INNER JOIN `articles` ON `articles`.`id` = `users`.`id`", nil,
    		},
    		{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  9. tests/scan_test.go

    	if err := DB.Select("people.*, addresses.*").
    		Table("people").
    		Joins("inner join person_addresses on people.id = person_addresses.person_id").
    		Joins("inner join addresses on person_addresses.address_id = addresses.id").
    		Find(&personAddressInfoList).Error; err != nil {
    		t.Errorf("Failed to run join query, got error: %v", err)
    	}
    
    	personMatched := false
    	addressMatched := false
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  10. schema/index.go

    			k := strings.TrimSpace(strings.ToUpper(v[0]))
    			if k == "INDEX" || k == "UNIQUEINDEX" {
    				var (
    					name       string
    					tag        = strings.Join(v[1:], ":")
    					idx        = strings.Index(tag, ",")
    					tagSetting = strings.Join(strings.Split(tag, ",")[1:], ",")
    					settings   = ParseTagSetting(tagSetting, ",")
    					length, _  = strconv.Atoi(settings["LENGTH"])
    				)
    
    				if idx == -1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
Back to top