Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 26 for uint32 (0.15 sec)

  1. tests/embedded_struct_test.go

    		ReadOnly
    	}
    
    	type Author struct {
    		ID    string
    		Name  string
    		Email string
    	}
    
    	type HNPost struct {
    		BasePost
    		Author  `gorm:"EmbeddedPrefix:user_"` // Embedded struct
    		Upvotes int32
    	}
    
    	type EngadgetPost struct {
    		BasePost BasePost `gorm:"Embedded"`
    		Author   *Author  `gorm:"Embedded;EmbeddedPrefix:author_"` // Embedded struct
    		ImageUrl string
    	}
    
    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)
  2. tests/soft_delete_test.go

    		t.Fatalf("invalid sql generated, got %v", actualSQL)
    	}
    }
    
    func TestSoftDeleteZeroValue(t *testing.T) {
    	type SoftDeleteBook struct {
    		ID        uint
    		Name      string
    		Pages     uint
    		DeletedAt gorm.DeletedAt `gorm:"zeroValue:'1970-01-01 00:00:01'"`
    	}
    	DB.Migrator().DropTable(&SoftDeleteBook{})
    	if err := DB.AutoMigrate(&SoftDeleteBook{}); err != nil {
    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)
  3. tests/joins_test.go

    		t.Fatalf("Failed to load with joins on, got error: %v", err)
    	}
    	AssertEqual(t, user2.NamedPet.Name, "joins-on_pet_2")
    }
    
    func TestJoinsWithSelect(t *testing.T) {
    	type result struct {
    		ID    uint
    		PetID uint
    		Name  string
    	}
    
    	user := *GetUser("joins_with_select", Config{Pets: 2})
    	DB.Save(&user)
    
    	var results []result
    
    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. tests/create_test.go

    	AssertEqual(t, newUser.CreatedAt, curTime)
    	AssertEqual(t, newUser.UpdatedAt, curTime)
    }
    
    func TestCreateWithNoGORMPrimaryKey(t *testing.T) {
    	type JoinTable struct {
    		UserID   uint
    		FriendID uint
    	}
    
    	DB.Migrator().DropTable(&JoinTable{})
    	if err := DB.AutoMigrate(&JoinTable{}); err != nil {
    		t.Errorf("no error should happen when auto migrate, but 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)
  5. tests/associations_has_many_test.go

    	AssertAssociationCount(t, users, "Toys", 0, "After Clear")
    }
    
    func TestHasManyAssociationUnscoped(t *testing.T) {
    	type ItemContent struct {
    		gorm.Model
    		ItemID       uint   `gorm:"not null"`
    		Name         string `gorm:"not null;type:varchar(50)"`
    		LanguageCode string `gorm:"not null;type:varchar(2)"`
    	}
    	type Item struct {
    		gorm.Model
    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)
  6. tests/preload_suits_test.go

    	type (
    		Level0 struct {
    			ID       uint
    			Value    string
    			Level1ID uint
    		}
    		Level1 struct {
    			ID         uint
    			Value      string
    			Level2ID   *uint
    			Level2_1ID *uint
    			Level0s    []Level0 `json:",omitempty"`
    		}
    		Level2 struct {
    			ID       uint
    			Level1s  []Level1
    			Level3ID uint
    		}
    		Level2_1 struct {
    			ID       uint
    			Level1s  []Level1 `json:",omitempty"`
    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)
  7. model.go

    // It may be embedded into your model or you may build your own model without it
    //
    //	type User struct {
    //	  gorm.Model
    //	}
    type Model struct {
    	ID        uint `gorm:"primarykey"`
    	CreatedAt time.Time
    	UpdatedAt time.Time
    	DeletedAt DeletedAt `gorm:"index"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:06:43 GMT 2023
    - 396 bytes
    - Viewed (0)
  8. tests/scan_test.go

    	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 {
    		t.Errorf("Scan into struct map, got %#v", results)
    	}
    
    	type ID uint64
    	var id ID
    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)
  9. tests/scanner_valuer_test.go

    	default:
    		return errors.New("not supported")
    	}
    }
    
    type Role struct {
    	Name string `gorm:"size:256"`
    }
    
    func (role *Role) Scan(value interface{}) error {
    	if b, ok := value.([]uint8); ok {
    		role.Name = string(b)
    	} else {
    		role.Name = value.(string)
    	}
    	return nil
    }
    
    func (role Role) Value() (driver.Value, error) {
    	return role.Name, 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)
  10. tests/update_test.go

    	user := *GetUser("update_column_skips_association", Config{})
    	DB.Create(&user)
    
    	// Update a single field of the user and verify that the changed address is not stored.
    	newAge := uint(100)
    	user.Account.Number = "new_account_number"
    	db := DB.Model(&user).UpdateColumns(User{Age: newAge})
    
    	if db.RowsAffected != 1 {
    		t.Errorf("Expected RowsAffected=1 but instead RowsAffected=%v", db.RowsAffected)
    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)
Back to top