Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 48 for goto (0.12 sec)

  1. scan.go

    					elem = reflectValue.Index(int(db.RowsAffected))
    					if onConflictDonothing {
    						for _, field := range fields {
    							if _, ok := field.ValueOf(db.Statement.Context, elem); !ok {
    								db.RowsAffected++
    								goto BEGIN
    							}
    						}
    					}
    				} else {
    					elem = reflect.New(reflectValueType)
    				}
    
    				db.scanIntoStruct(rows, elem, values, fields, joinFields)
    
    				if !update {
    					if !isPtr {
    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/preload_suits_test.go

    		t.Errorf("got %s; want %s", toJSONString(got2), toJSONString(want2))
    	}
    
    	var got3 []Level2
    	if err := DB.Preload("Level1s").Find(&got3, "value IN (?)", []string{"Bob", "Tom"}).Error; err != nil {
    		t.Error(err)
    	}
    
    	if !reflect.DeepEqual(got3, []Level2{got, got2}) {
    		t.Errorf("got %s; want %s", toJSONString(got3), toJSONString([]Level2{got, got2}))
    	}
    
    	var got4 []Level2
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  3. tests/connpool_test.go

    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.QueryContext(ctx, query, args...)
    }
    
    func (c *wrapperTx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.QueryRowContext(ctx, query, args...)
    }
    
    type wrapperConnPool struct {
    	db     *sql.DB
    	got    []string
    	expect []string
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  4. tests/associations_has_many_test.go

    		t.Errorf("expected %d contents, got %d", 3, count)
    	}
    
    	var contents []ItemContent
    	if err := tx.Find(&contents).Error; err != nil {
    		t.Errorf("failed to find contents, got error: %v", err)
    	}
    	if len(contents) != 3 {
    		t.Errorf("expected %d contents, got %d", 3, len(contents))
    	}
    
    	// test delete
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  5. tests/count_test.go

    		t.Errorf(fmt.Sprintf("Count should work, but got err %v", err))
    	}
    	if count1 != 1 {
    		t.Errorf("Count with group should be 1, but got count: %v", count1)
    	}
    
    	var count2 int64
    	if err := DB.Model(&Company{}).Where("name in ?", []string{"company_count_group_b", "company_count_group_c"}).Group("name").Count(&count2).Error; err != nil {
    		t.Errorf(fmt.Sprintf("Count should work, but got err %v", err))
    	}
    	if count2 != 2 {
    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)
  6. tests/soft_delete_test.go

    		t.Errorf("Count soft deleted record, expects: %v, got: %v", 1, count)
    	}
    
    	if DB.Model(&User{}).Select("age").Where("name = ?", user.Name).Scan(&age).Error != nil || age != user.Age {
    		t.Errorf("Age soft deleted record, expects: %v, got: %v", 0, age)
    	}
    
    	if err := DB.Delete(&user).Error; err != nil {
    		t.Fatalf("No error should happen when soft delete user, but got %v", err)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  7. tests/embedded_struct_test.go

    		t.Errorf("Expected to get Author content %v but got: %v", NewPost.Author.Content, hnPost.Author.Content)
    	}
    
    	if hnPost.Author.ContentPtr != nil {
    		t.Errorf("Expected to get nil Author contentPtr but got: %v", hnPost.Author.ContentPtr)
    	}
    
    	if NewPost.Author.Birthday.UnixMilli() != hnPost.Author.Birthday.UnixMilli() {
    		t.Errorf("Expected to get Author birthday with %+v but got: %+v", NewPost.Author.Birthday, hnPost.Author.Birthday)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  8. tests/prepared_stmt_test.go

    		t.Errorf("Failed to start transaction, got error %v\n", err)
    	}
    
    	if err := tx.Where("name=?", "zzjin").Delete(&User{}).Error; err != nil {
    		tx.Rollback()
    		t.Errorf("Failed to run one transaction, got error %v\n", err)
    	}
    
    	if err := tx.Create(&User{Name: "zzjin"}).Error; err != nil {
    		tx.Rollback()
    		t.Errorf("Failed to run one transaction, got error %v\n", err)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  9. tests/create_test.go

    		t.Errorf("no error should happen when auto migrate, but got %v", err)
    	}
    
    	if err := DB.Create(&EmptyStruct{}).Error; err != nil {
    		t.Errorf("No error should happen when creating user, but got %v", err)
    	}
    }
    
    func TestCreateEmptySlice(t *testing.T) {
    	data := []User{}
    	if err := DB.Create(&data).Error; err != gorm.ErrEmptySlice {
    		t.Errorf("no data should be created, got %v", err)
    	}
    
    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)
  10. tests/joins_test.go

    	var users2 []User
    	if err := DB.Joins("Company").Joins("Manager").Joins("Account").Find(&users2, "users.id IN ?", userIDs).Error; err != nil {
    		t.Fatalf("Failed to load with joins, got error: %v", err)
    	} else if len(users2) != len(users) {
    		t.Fatalf("Failed to load join users, got: %v, expect: %v", len(users2), len(users))
    	}
    
    	sort.Slice(users2, func(i, j int) bool {
    		return users2[i].ID > users2[j].ID
    	})
    
    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)
Back to top