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

subscribe

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: 5 Imported by: 0

Documentation

Overview

Package subscribe holds the subscription module's plan entities: the plans (the subscribe table) and their groups (subscribe_group).

Index

Constants

View Source
const MaxSubscribePageSize = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type Discount

type Discount struct {
	Months   int64 `json:"months"`
	Discount int64 `json:"discount"`
}

type FilterParams

type FilterParams struct {
	Page            int      // Page Number
	Size            int      // Page Size
	Ids             []int64  // Subscribe IDs
	Node            []int64  // Node IDs
	Tags            []string // Node Tags
	Show            bool     // Show Portal Page
	Sell            bool     // Sell
	Language        string   // Language
	DefaultLanguage bool     // Default Subscribe Language Data
	Search          string   // Search Keywords
}

FilterParams filters and pages the plan list.

func (*FilterParams) Normalize

func (p *FilterParams) Normalize()

type Group

type Group struct {
	Id          int64     `gorm:"primaryKey"`
	Name        string    `gorm:"type:varchar(255);not null;default:'';comment:Group Name"`
	Description string    `gorm:"type:text;comment:Group Description"`
	CreatedAt   time.Time `gorm:"<-:create;comment:Create Time"`
	UpdatedAt   time.Time `gorm:"comment:Update Time"`
}

func (Group) TableName

func (Group) TableName() string

type Subscribe

type Subscribe struct {
	Id                int64     `gorm:"primaryKey"`
	Name              string    `gorm:"type:varchar(255);not null;default:'';comment:Subscribe Name"`
	Language          string    `gorm:"type:varchar(255);not null;default:'';comment:Language"`
	Description       string    `gorm:"type:text;comment:Subscribe Description"`
	UnitPrice         int64     `gorm:"type:int;not null;default:0;comment:Unit Price"`
	UnitTime          string    `gorm:"type:varchar(255);not null;default:'';comment:Unit Time"`
	Discount          string    `gorm:"type:text;comment:Discount"`
	Replacement       int64     `gorm:"type:int;not null;default:0;comment:Replacement"`
	Inventory         int64     `gorm:"type:int;not null;default:-1;comment:Inventory"`
	Traffic           int64     `gorm:"type:int;not null;default:0;comment:Traffic"`
	SpeedLimit        int64     `gorm:"type:int;not null;default:0;comment:Speed Limit"`
	DeviceLimit       int64     `gorm:"type:int;not null;default:0;comment:Device Limit"`
	Quota             int64     `gorm:"type:int;not null;default:0;comment:Quota"`
	Nodes             string    `gorm:"type:varchar(255);comment:Node Ids"`
	NodeTags          string    `gorm:"type:varchar(255);comment:Node Tags"`
	Show              *bool     `gorm:"type:tinyint(1);not null;default:0;comment:Show portal page"`
	Sell              *bool     `gorm:"type:tinyint(1);not null;default:0;comment:Sell"`
	Sort              int64     `gorm:"type:int;not null;default:0;comment:Sort"`
	DeductionRatio    int64     `gorm:"type:int;default:0;comment:Deduction Ratio"`
	AllowDeduction    *bool     `gorm:"type:tinyint(1);default:1;comment:Allow deduction"`
	ResetCycle        int64     `gorm:"type:int;default:0;comment:Reset Cycle: 0: No Reset, 1: 1st, 2: Monthly, 3: Yearly"`
	RenewalReset      *bool     `gorm:"type:tinyint(1);default:0;comment:Renew Reset"`
	ShowOriginalPrice bool      `gorm:"type:tinyint(1);not null;default:1;comment:Show Original Price"`
	CreatedAt         time.Time `gorm:"<-:create;comment:Create Time"`
	UpdatedAt         time.Time `gorm:"comment:Update Time"`
}

func (*Subscribe) BeforeCreate

func (s *Subscribe) BeforeCreate(tx *gorm.DB) error

func (*Subscribe) BeforeDelete

func (s *Subscribe) BeforeDelete(tx *gorm.DB) error

func (*Subscribe) BeforeUpdate

func (s *Subscribe) BeforeUpdate(tx *gorm.DB) error

func (*Subscribe) NodeScope added in v1.21.0

func (s *Subscribe) NodeScope() (nodeIDs []int64, tags []string, err error)

NodeScope returns the nodes the plan selects: explicit node ids and node tags, the tags trimmed, without empty entries and duplicates. A node matching either belongs to the plan; a plan selecting neither has no nodes. A damaged node id list is an error rather than a shorter list, so a plan never silently serves fewer (or, read as empty, no) nodes.

func (*Subscribe) TableName

func (*Subscribe) TableName() string

Jump to

Keyboard shortcuts

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