Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 100 for Errorf (0.24 sec)

  1. tests/update_belongs_to_test.go

    	user := *GetUser("update-belongs-to", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Company = Company{Name: "company-belongs-to-association"}
    	user.Manager = &User{Name: "manager-belongs-to-association"}
    	if err := DB.Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user2 User
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jul 14 06:55:54 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  2. migrator/migrator.go

    			}
    
    			return m.DB.Exec(createIndexSQL, values...).Error
    		}
    
    		return fmt.Errorf("failed to create index with name %s", name)
    	})
    }
    
    // DropIndex drop index `name`
    func (m Migrator) DropIndex(value interface{}, name string) error {
    	return m.RunWithValue(value, func(stmt *gorm.Statement) error {
    		if stmt.Schema != nil {
    			if idx := stmt.Schema.LookIndex(name); idx != 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)
  3. schema/utils_test.go

    	}
    
    	for k, v := range tags {
    		if string(removeSettingFromTag(reflect.StructTag(k), "column")) != v {
    			t.Errorf("%v after removeSettingFromTag should equal %v, but got %v", k, v, removeSettingFromTag(reflect.StructTag(k), "column"))
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jul 31 10:19:25 GMT 2020
    - 1.5K bytes
    - Viewed (0)
  4. tests/update_test.go

    	if res := DB.Model(user).Updates(values); res.Error != nil {
    		t.Errorf("errors happened when update: %v", res.Error)
    	} else if res.RowsAffected != 1 {
    		t.Errorf("rows affected should be 1, but got : %v", res.RowsAffected)
    	} else if user.Age != 5 {
    		t.Errorf("Age should equals to 5, but got %v", user.Age)
    	} else if user.Active != true {
    		t.Errorf("Active should be true, but got %v", user.Active)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  5. tests/scanner_valuer_test.go

    	if err := DB.Create(&data).Error; err != nil {
    		t.Errorf("Should got no error when creating data, but got %v", err)
    	}
    
    	if err := DB.Model(&data).Update("password", EncryptedData("xnewpass")).Error; err == nil {
    		t.Errorf("Should failed to update data with invalid data")
    	}
    
    	if err := DB.Model(&data).Update("password", EncryptedData("newpass")).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  6. clause/joins_test.go

    			stmt := &gorm.Statement{DB: db, Table: user.Table, Schema: user, Clauses: map[string]clause.Clause{}}
    			result.join.Build(stmt)
    			if result.sql != stmt.SQL.String() {
    				t.Errorf("want: %s, got: %s", result.sql, stmt.SQL.String())
    			}
    		})
    	}
    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)
  7. tests/scan_test.go

    	if err != nil {
    		t.Errorf("Not error should happen, got %v", err)
    	}
    
    	type Result struct {
    		Name string
    		Age  int
    	}
    
    	var results []Result
    	for rows.Next() {
    		var result Result
    		if err := DB.ScanRows(rows, &result); err != nil {
    			t.Errorf("should get no error, but got %v", err)
    		}
    		results = append(results, result)
    	}
    
    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)
  8. chainable_api.go

    			case string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg)
    			case []string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg...)
    			default:
    				tx.AddError(fmt.Errorf("unsupported select args %v %v", query, args))
    				return
    			}
    		}
    
    		if clause, ok := tx.Statement.Clauses["SELECT"]; ok {
    			clause.Expression = nil
    			tx.Statement.Clauses["SELECT"] = clause
    		}
    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)
  9. callbacks/query.go

    		db.Statement.AddClauseIfNotExists(clauseSelect)
    
    		db.Statement.Build(db.Statement.BuildClauses...)
    	}
    }
    
    func Preload(db *gorm.DB) {
    	if db.Error == nil && len(db.Statement.Preloads) > 0 {
    		if db.Statement.Schema == nil {
    			db.AddError(fmt.Errorf("%w when using preload", gorm.ErrModelValueRequired))
    			return
    		}
    
    		joins := make([]string, 0, len(db.Statement.Joins))
    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)
  10. tests/associations_has_one_test.go

    	if err := DB.Model(&user2).Association("Account").Append(&account); err != nil {
    		t.Fatalf("Error happened when append Account, got %v", err)
    	}
    
    	AssertAssociationCount(t, user2, "Account", 1, "after prepare data")
    
    	// Clear
    	if err := DB.Model(&user2).Association("Account").Clear(); err != nil {
    		t.Errorf("Error happened when clear Account, got %v", err)
    	}
    
    	AssertAssociationCount(t, user2, "Account", 0, "after clear")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
Back to top