Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestNamedPolymorphic (0.18 sec)

  1. tests/named_polymorphic_test.go

    	Id           int
    	Name         string
    	PreferredToy Toy `gorm:"polymorphic:Owner;polymorphicValue:hamster_preferred"`
    	OtherToy     Toy `gorm:"polymorphic:Owner;polymorphicValue:hamster_other"`
    }
    
    func TestNamedPolymorphic(t *testing.T) {
    	DB.Migrator().DropTable(&Hamster{})
    	DB.AutoMigrate(&Hamster{})
    
    	hamster := Hamster{Name: "Mr. Hammond", PreferredToy: Toy{Name: "bike"}, OtherToy: Toy{Name: "treadmill"}}
    	DB.Save(&hamster)
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jul 08 09:59:40 UTC 2020
    - 4.2K bytes
    - Viewed (0)
Back to top