Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for john (0.2 sec)

  1. chainable_api.go

    	}
    	return
    }
    
    // Or add OR conditions
    //
    // Or is used to chain together queries with an OR.
    //
    //	// Find the first user with name equal to jinzhu or john
    //	db.Where("name = ?", "jinzhu").Or("name = ?", "john").First(&user)
    func (db *DB) Or(query interface{}, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	if conds := tx.Statement.BuildCondition(query, args...); len(conds) > 0 {
    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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  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. 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)
  9. 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)
  10. 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)
Back to top