Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 39 for alice (0.27 sec)

  1. callbacks/create_test.go

    	if err != nil {
    		t.Errorf("parse schema error: %v, is not expected", err)
    		return
    	}
    	dest := []*user{
    		{
    			ID:    1,
    			Name:  "alice",
    			Email: "email",
    			Age:   18,
    		},
    		{
    			ID:    2,
    			Name:  "bob",
    			Email: "email",
    			Age:   19,
    		},
    	}
    	stmt := &gorm.Statement{
    		DB: &gorm.DB{
    			Config: &gorm.Config{
    				NowFunc: func() time.Time { return time.Time{} },
    			},
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  2. tests/helper_test.go

    		if len(user.Pets) != len(expect.Pets) {
    			t.Fatalf("pets should equal, expect: %v, got %v", len(expect.Pets), len(user.Pets))
    		}
    
    		sort.Slice(user.Pets, func(i, j int) bool {
    			return user.Pets[i].ID > user.Pets[j].ID
    		})
    
    		sort.Slice(expect.Pets, func(i, j int) bool {
    			return expect.Pets[i].ID > expect.Pets[j].ID
    		})
    
    		for idx, pet := range user.Pets {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  3. tests/associations_has_one_test.go

    		t.Errorf("account's number should not be saved")
    	}
    }
    
    func TestHasOneAssociationForSlice(t *testing.T) {
    	users := []User{
    		*GetUser("slice-hasone-1", Config{Account: true}),
    		*GetUser("slice-hasone-2", Config{Account: false}),
    		*GetUser("slice-hasone-3", Config{Account: true}),
    	}
    
    	DB.Create(&users)
    
    	// Count
    	AssertAssociationCount(t, users, "Account", 2, "")
    
    	// Find
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
  4. tests/update_test.go

    	sort.Slice(result.Pets, func(i, j int) bool {
    		return result.Pets[i].ID < result.Pets[j].ID
    	})
    	sort.Slice(result.Team, func(i, j int) bool {
    		return result.Team[i].ID < result.Team[j].ID
    	})
    	sort.Slice(result.Friends, func(i, j int) bool {
    		return result.Friends[i].ID < result.Friends[j].ID
    	})
    	sort.Slice(result2.Pets, func(i, j int) bool {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  5. schema/utils.go

    				result := reflect.Indirect(rel.Field.ReflectValueOf(ctx, value))
    				switch result.Kind() {
    				case reflect.Struct:
    					reflectResults = reflect.Append(reflectResults, result.Addr())
    				case reflect.Slice, reflect.Array:
    					for i := 0; i < result.Len(); i++ {
    						if elem := result.Index(i); elem.Kind() == reflect.Ptr {
    							reflectResults = reflect.Append(reflectResults, elem)
    						} else {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  6. callbacks/callmethod.go

    	tx := db.Session(&gorm.Session{NewDB: true})
    	if called := fc(db.Statement.ReflectValue.Interface(), tx); !called {
    		switch db.Statement.ReflectValue.Kind() {
    		case reflect.Slice, reflect.Array:
    			db.Statement.CurDestIndex = 0
    			for i := 0; i < db.Statement.ReflectValue.Len(); i++ {
    				if value := reflect.Indirect(db.Statement.ReflectValue.Index(i)); value.CanAddr() {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  7. schema/index.go

    				}
    				if idx.Comment == "" {
    					idx.Comment = index.Comment
    				}
    				if idx.Option == "" {
    					idx.Option = index.Option
    				}
    
    				idx.Fields = append(idx.Fields, index.Fields...)
    				sort.Slice(idx.Fields, func(i, j int) bool {
    					return idx.Fields[i].priority < idx.Fields[j].priority
    				})
    
    				indexes[index.Name] = idx
    			}
    		}
    	}
    	for _, index := range indexes {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  8. tests/scan_test.go

    		t.Errorf("Scan double age as age, expect: %v, got %v", res.Age*2, doubleAgeRes.Age)
    	}
    
    	var results []result
    	DB.Table("users").Select("name, age").Where("id in ?", []uint{user2.ID, user3.ID}).Scan(&results)
    
    	sort.Slice(results, func(i, j int) bool {
    		return strings.Compare(results[i].Name, results[j].Name) <= -1
    	})
    
    	if len(results) != 2 || results[0].Name != user2.Name || results[1].Name != user3.Name {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  9. tests/preload_test.go

    	DB.Preload("Pets.Toy").Find(&user4, "id = ?", user.ID)
    	CheckUser(t, *user4, user)
    }
    
    func TestNestedPreloadForSlice(t *testing.T) {
    	users := []User{
    		*GetUser("slice_nested_preload_1", Config{Pets: 2}),
    		*GetUser("slice_nested_preload_2", Config{Pets: 0}),
    		*GetUser("slice_nested_preload_3", Config{Pets: 3}),
    	}
    
    	for _, user := range users {
    		for idx, pet := range user.Pets {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 13.4K bytes
    - Viewed (0)
  10. tests/associations_belongs_to_test.go

    		&Company{Name: "company-slice-append-1"},
    		&Company{Name: "company-slice-append-2"},
    		&Company{Name: "company-slice-append-3"},
    	)
    
    	AssertAssociationCount(t, users, "Company", 3, "After Append")
    
    	DB.Model(&users).Association("Manager").Append(
    		GetUser("manager-slice-belongs-to-1", Config{}),
    		GetUser("manager-slice-belongs-to-2", Config{}),
    		GetUser("manager-slice-belongs-to-3", Config{}),
    	)
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
Back to top