Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for elseif (0.14 sec)

  1. scan.go

    				continue
    			}
    			values[idx] = new(interface{})
    		}
    	} else if len(columnTypes) > 0 {
    		for idx, columnType := range columnTypes {
    			if columnType.ScanType() != nil {
    				values[idx] = reflect.New(reflect.PtrTo(columnType.ScanType())).Interface()
    			} else {
    				values[idx] = new(interface{})
    			}
    		}
    	} else {
    		for idx := range columns {
    			values[idx] = new(interface{})
    		}
    	}
    }
    
    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)
  2. tests/create_test.go

    	}
    
    	for _, user := range users {
    		if user.ID == 0 {
    			t.Fatalf("failed to fill user's ID, got %v", user.ID)
    		} else {
    			var newUser User
    			if err := DB.Where("id = ?", user.ID).Preload(clause.Associations).First(&newUser).Error; err != nil {
    				t.Fatalf("errors happened when query: %v", err)
    			} else {
    				CheckUser(t, newUser, user)
    			}
    		}
    	}
    }
    
    func TestCreateInBatchesWithDefaultSize(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  3. tests/joins_test.go

    		Joins("LEFT OUTER JOIN pets ON pets.user_id = users.id").Find(&results)
    
    	if len(results) == 0 {
    		t.Fatalf("no record find")
    	} else if results[0].Pet.UserID == nil || *(results[0].Pet.UserID) != user.ID {
    		t.Fatalf("wrong user id in pet")
    	} else if results[0].Pet.Name != user.Pets[0].Name {
    		t.Fatalf("wrong pet name")
    	}
    }
    
    func TestJoinArgsWithDB(t *testing.T) {
    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)
  4. schema/relationship_test.go

    )
    
    func checkStructRelation(t *testing.T, data interface{}, relations ...Relation) {
    	if s, err := schema.Parse(data, &sync.Map{}, schema.NamingStrategy{}); err != nil {
    		t.Errorf("Failed to parse schema, got error %v", err)
    	} else {
    		for _, rel := range relations {
    			checkSchemaRelation(t, s, rel)
    		}
    	}
    }
    
    func TestBelongsToOverrideForeignKey(t *testing.T) {
    	type Profile struct {
    		gorm.Model
    		Name string
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  5. callbacks/query.go

    				if db.Statement.Schema == nil {
    					clauseSelect.Columns[idx] = clause.Column{Name: name, Raw: true}
    				} else if f := db.Statement.Schema.LookUpField(name); f != nil {
    					clauseSelect.Columns[idx] = clause.Column{Name: f.DBName}
    				} else {
    					clauseSelect.Columns[idx] = clause.Column{Name: name, Raw: true}
    				}
    			}
    		} else if db.Statement.Schema != nil && len(db.Statement.Omits) > 0 {
    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)
  6. tests/upsert_test.go

    	}
    
    	if err := DB.Find(&langs, "code = ?", lang.Code).Error; err != nil {
    		t.Errorf("no error should happen when find languages with code, but got %v", err)
    	} else if len(langs) != 1 {
    		t.Errorf("should only find only 1 languages, but got %+v", langs)
    	} else if langs[0].Name != "upsert-new" {
    		t.Errorf("should update name on conflict, but got name %+v", langs[0].Name)
    	}
    
    	lang = Language{Code: "upsert", Name: "Upsert-Newname"}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  7. callbacks/associations.go

    							fv, _ := ref.PrimaryKey.ValueOf(db.Statement.Context, obj)
    							db.AddError(ref.ForeignKey.Set(db.Statement.Context, joinValue, fv))
    						} else if ref.PrimaryValue != "" {
    							db.AddError(ref.ForeignKey.Set(db.Statement.Context, joinValue, ref.PrimaryValue))
    						} else {
    							fv, _ := ref.PrimaryKey.ValueOf(db.Statement.Context, elem)
    							db.AddError(ref.ForeignKey.Set(db.Statement.Context, joinValue, fv))
    						}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  8. migrator/migrator.go

    	if v, ok := oldName.(string); ok {
    		oldTable = clause.Table{Name: v}
    	} else {
    		stmt := &gorm.Statement{DB: m.DB}
    		if err := stmt.Parse(oldName); err == nil {
    			oldTable = m.CurrentTable(stmt)
    		} else {
    			return err
    		}
    	}
    
    	if v, ok := newName.(string); ok {
    		newTable = clause.Table{Name: v}
    	} else {
    		stmt := &gorm.Statement{DB: m.DB}
    		if err := stmt.Parse(newName); err == nil {
    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. chainable_api.go

    				tx.Statement.Table = results[1]
    			} else {
    				tx.Statement.Table = results[2]
    			}
    		}
    	} else if tables := strings.Split(name, "."); len(tables) == 2 {
    		tx.Statement.TableExpr = &clause.Expr{SQL: tx.Statement.Quote(name)}
    		tx.Statement.Table = tables[1]
    	} else if name != "" {
    		tx.Statement.TableExpr = &clause.Expr{SQL: tx.Statement.Quote(name)}
    		tx.Statement.Table = name
    	} else {
    		tx.Statement.TableExpr = nil
    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)
  10. finisher_api.go

    		}
    
    		return tx.Create(dest)
    	} else if len(db.Statement.assigns) > 0 {
    		exprs := tx.Statement.BuildCondition(db.Statement.assigns[0], db.Statement.assigns[1:]...)
    		assigns := map[string]interface{}{}
    		for i := 0; i < len(exprs); i++ {
    			expr := exprs[i]
    
    			if eq, ok := expr.(clause.AndConditions); ok {
    				exprs = append(exprs, eq.Exprs...)
    			} else if eq, ok := expr.(clause.Eq); ok {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
Back to top