Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 37 for If (0.17 sec)

  1. schema/relationship.go

    			if f == nil {
    				reguessOrErr()
    				return
    			}
    			foreignFields = append(foreignFields, f)
    		}
    	} else {
    		primarySchemaName := primarySchema.Name
    		if primarySchemaName == "" {
    			primarySchemaName = relation.FieldSchema.Name
    		}
    
    		if len(relation.primaryKeys) > 0 {
    			for _, primaryKey := range relation.primaryKeys {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 03:46:59 UTC 2024
    - 22.7K bytes
    - Viewed (0)
  2. callbacks/query.go

    									onStmt.AddClause(c)
    								}
    
    								if join.On != nil {
    									onStmt.AddClause(join.On)
    								}
    
    								if cs, ok := onStmt.Clauses["WHERE"]; ok {
    									if where, ok := cs.Expression.(clause.Where); ok {
    										where.Build(&onStmt)
    
    										if onSQL := onStmt.SQL.String(); onSQL != "" {
    											vars := onStmt.Vars
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 09:51:44 UTC 2024
    - 10.1K bytes
    - Viewed (0)
  3. tests/non_std_test.go

    	DB.First(&animal, animal.Counter)
    	if animal.Name != "galeone" {
    		t.Errorf("Name fields shouldn't be changed if untouched, but got %v", animal.Name)
    	}
    
    	// When changing a field with a default value, the change must occur
    	animal.Name = "amazing horse"
    	DB.Save(&animal)
    	DB.First(&animal, animal.Counter)
    	if animal.Name != "amazing horse" {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  4. callbacks/create.go

    			mapValues, ok := values.([]map[string]interface{})
    			if !ok {
    				if v, ok := values.(*[]map[string]interface{}); ok {
    					if *v != nil {
    						mapValues = *v
    					}
    				}
    			}
    
    			if config.LastInsertIDReversed {
    				insertID -= int64(len(mapValues)-1) * schema.DefaultAutoIncrementIncrement
    			}
    
    			for _, mapValue := range mapValues {
    				if mapValue != nil {
    					mapValue[pkFieldName] = insertID
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Apr 08 03:29:55 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  5. migrator/migrator.go

    			for _, alias := range aliases {
    				if strings.HasPrefix(fullDataType, alias) {
    					isSameType = true
    					break
    				}
    			}
    
    			if !isSameType {
    				alterColumn = true
    			}
    		}
    	}
    
    	if !isSameType {
    		// check size
    		if length, ok := columnType.Length(); length != int64(field.Size) {
    			if length > 0 && field.Size > 0 {
    				alterColumn = true
    			} else {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Apr 26 07:15:49 UTC 2024
    - 29K bytes
    - Viewed (0)
  6. tests/embedded_struct_test.go

    }
    
    func (c *Content) Scan(src interface{}) error {
    	var value Content
    	str, ok := src.(string)
    	if !ok {
    		byt, ok := src.([]byte)
    		if !ok {
    			return errors.New("Embedded.Scan byte assertion failed")
    		}
    		if err := json.Unmarshal(byt, &value); err != nil {
    			return err
    		}
    	} else {
    		if err := json.Unmarshal([]byte(str), &value); err != nil {
    			return err
    		}
    	}
    
    	*c = value
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  7. tests/query_test.go

    	DB.Create(&user)
    
    	var result User
    	if DB.Where("").Where("").First(&result).Error != nil {
    		t.Errorf("Should not raise any error if searching with empty strings")
    	}
    
    	result = User{}
    	if DB.Where(&User{}).Where("name = ?", user.Name).First(&result).Error != nil {
    		t.Errorf("Should not raise any error if searching with empty struct")
    	}
    
    	result = User{}
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 49.8K bytes
    - Viewed (0)
  8. tests/helper_test.go

    	}
    
    	for i := 0; i < config.Tools; i++ {
    		user.Tools = append(user.Tools, Tools{Name: name + "_tool_" + strconv.Itoa(i+1)})
    	}
    
    	if config.Company {
    		user.Company = Company{Name: "company-" + name}
    	}
    
    	if config.Manager {
    		user.Manager = GetUser(name+"_manager", Config{})
    	}
    
    	for i := 0; i < config.Team; i++ {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Tue Mar 19 03:50:28 UTC 2024
    - 8K bytes
    - Viewed (0)
  9. chainable_api.go

    	tx = db.getInstance()
    	if strings.Contains(name, " ") || strings.Contains(name, "`") || len(args) > 0 {
    		tx.Statement.TableExpr = &clause.Expr{SQL: name, Vars: args}
    		if results := tableRegexp.FindStringSubmatch(name); len(results) == 3 {
    			if results[1] != "" {
    				tx.Statement.Table = results[1]
    			} else {
    				tx.Statement.Table = results[2]
    			}
    		}
    	} else if tables := strings.Split(name, "."); len(tables) == 2 {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 09:47:34 UTC 2024
    - 14.5K bytes
    - Viewed (0)
  10. tests/default_value_test.go

    	}
    
    	DB.Migrator().DropTable(&Harumph{})
    
    	if err := DB.AutoMigrate(&Harumph{}); err != nil {
    		t.Fatalf("Failed to migrate with default value, got error: %v", err)
    	}
    
    	harumph := Harumph{Email: "******@****.***"}
    	if err := DB.Create(&harumph).Error; err != nil {
    		t.Fatalf("Failed to create data with default value, got error: %v", err)
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Apr 08 03:29:55 UTC 2024
    - 2.3K bytes
    - Viewed (0)
Back to top