Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for AppliesToProduct (0.27 sec)

  1. tests/associations_test.go

    		t.Errorf("failed to create orders, got %v", err)
    	}
    
    	coupon2 := Coupon{
    		AppliesToProduct: []*CouponProduct{{Desc: "coupon-description"}},
    	}
    
    	DB.Session(&gorm.Session{FullSaveAssociations: true}).Create(&coupon2)
    	var result Coupon
    	if err := DB.Preload("AppliesToProduct").First(&result, "id = ?", coupon2.ID).Error; err != nil {
    		t.Errorf("Failed to create coupon w/o name, got error: %v", err)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  2. utils/tests/models.go

    	ID   int
    	Name string
    }
    
    type Language struct {
    	Code string `gorm:"primarykey"`
    	Name string
    }
    
    type Coupon struct {
    	ID               int              `gorm:"primarykey; size:255"`
    	AppliesToProduct []*CouponProduct `gorm:"foreignKey:CouponId;constraint:OnDelete:CASCADE"`
    	AmountOff        uint32           `gorm:"column:amount_off"`
    	PercentOff       float32          `gorm:"column:percent_off"`
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 2.1K bytes
    - Viewed (0)
Back to top