Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 35 for join (0.23 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)
    				}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  2. utils/utils.go

    		default:
    			results[idx] = "nil"
    			vv := reflect.ValueOf(v)
    			if vv.IsValid() && !vv.IsZero() {
    				results[idx] = fmt.Sprint(reflect.Indirect(vv).Interface())
    			}
    		}
    	}
    
    	return strings.Join(results, "_")
    }
    
    func Contains(elems []string, elem string) bool {
    	for _, e := range elems {
    		if elem == e {
    			return true
    		}
    	}
    	return false
    }
    
    func AssertEqual(x, y interface{}) bool {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  3. chainable_api.go

    	}
    	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{}))
    func (db *DB) Joins(query string, args ...interface{}) (tx *DB) {
    	return joins(db, clause.LeftJoin, query, args...)
    }
    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)
  4. schema/naming.go

    }
    
    // ColumnName convert string to column name
    func (ns NamingStrategy) ColumnName(table, column string) string {
    	return ns.toDBName(column)
    }
    
    // JoinTableName convert string to join table name
    func (ns NamingStrategy) JoinTableName(str string) string {
    	if !ns.NoLowerCase && strings.ToLower(str) == str {
    		return ns.TablePrefix + str
    	}
    
    	if ns.SingularTable {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  5. clause/from_test.go

    					Joins: []clause.Join{
    						{
    							Type:  clause.RightJoin,
    							Table: clause.Table{Name: "profiles"},
    							ON: clause.Where{
    								[]clause.Expression{clause.Eq{clause.Column{Table: "profiles", Name: "email"}, clause.Column{Table: clause.CurrentTable, Name: "email"}}},
    							},
    						},
    					},
    				}, clause.From{
    					Joins: []clause.Join{
    						{
    							Type:  clause.InnerJoin,
    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)
  6. 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)
  7. 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)
  8. 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)
  9. schema/utils.go

    					names[i] = ""
    				} else {
    					break
    				}
    			}
    		}
    
    		values := strings.Split(names[j], ":")
    		k := strings.TrimSpace(strings.ToUpper(values[0]))
    
    		if len(values) >= 2 {
    			settings[k] = strings.Join(values[1:], ":")
    		} else if k != "" {
    			settings[k] = k
    		}
    	}
    
    	return settings
    }
    
    func toColumns(val string) (results []string) {
    	if val != "" {
    		for _, v := range strings.Split(val, ",") {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  10. tests/migrate_test.go

    	query := DB.Model(&User{}).
    		Select("users.id as users_id, users.name as users_name, pets.id as pets_id, pets.name as pets_name").
    		Joins("inner join pets on pets.user_id = users.id")
    
    	if err := DB.Migrator().CreateView("users_pets", gorm.ViewOption{Query: query}); err != nil {
    		t.Fatalf("Failed to crate view, got %v", err)
    	}
    
    	var count int64
    	if err := DB.Table("users_pets").Count(&count).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
Back to top