Help us shape the future of Go! Take the 2026 Go Developer Survey

coupon

package
v1.21.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package coupon holds the billing domain's coupon entity: a discount code with its validity window, usage limits and the plans it applies to.

Index

Constants

View Source
const (
	// TypePercentage coupons take Discount percent of the order amount.
	TypePercentage uint8 = 1
	// TypeFixed coupons take Discount minor units off the order amount.
	TypeFixed uint8 = 2
)

Coupon types, the values of the Type column.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coupon

type Coupon struct {
	Id         int64     `gorm:"primaryKey"`
	Name       string    `gorm:"type:varchar(255);not null;default:'';comment:Coupon Name"`
	Code       string    `gorm:"type:varchar(255);not null;default:'';unique;comment:Coupon Code"`
	Count      int64     `gorm:"type:int;not null;default:0;comment:Count Limit"`
	Type       uint8     `gorm:"type:tinyint(1);not null;default:1;comment:Coupon Type: 1: Percentage 2: Fixed Amount"`
	Discount   int64     `gorm:"type:int;not null;default:0;comment:Coupon Discount"`
	StartTime  int64     `gorm:"type:int;not null;default:0;comment:Start Time"`
	ExpireTime int64     `gorm:"type:int;not null;default:0;comment:Expire Time"`
	UserLimit  int64     `gorm:"type:int;not null;default:0;comment:User Limit"`
	Subscribe  string    `gorm:"type:varchar(255);not null;default:'';comment:Subscribe Limit"`
	UsedCount  int64     `gorm:"type:int;not null;default:0;comment:Used Count"`
	Enable     *bool     `gorm:"type:tinyint(1);not null;default:1;comment:Enable"`
	CreatedAt  time.Time `gorm:"<-:create;comment:Create Time"`
	UpdatedAt  time.Time `gorm:"comment:Update Time"`
}

func (*Coupon) IsEnabled

func (c *Coupon) IsEnabled() bool

func (Coupon) TableName

func (Coupon) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL