task

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Undefined Type = -1
	TypeEmail      = iota
	TypeQuota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailContent added in v1.1.0

type EmailContent struct {
	Subject string `json:"subject"`
	Content string `json:"content"`
}

func (*EmailContent) Marshal added in v1.1.0

func (c *EmailContent) Marshal() ([]byte, error)

func (*EmailContent) Unmarshal added in v1.1.0

func (c *EmailContent) Unmarshal(data []byte) error

type EmailScope added in v1.1.0

type EmailScope struct {
	Type              int8     `gorm:"not null;comment:Scope Type"`
	RegisterStartTime int64    `json:"register_start_time"`
	RegisterEndTime   int64    `json:"register_end_time"`
	Recipients        []string `json:"recipients"` // list of email addresses
	Additional        []string `json:"additional"` // additional email addresses
	Scheduled         int64    `json:"scheduled"`  // scheduled time (unix timestamp)
	Interval          uint8    `json:"interval"`   // interval in seconds
	Limit             uint64   `json:"limit"`      // daily send limit
}

func (*EmailScope) Marshal added in v1.1.0

func (s *EmailScope) Marshal() ([]byte, error)

func (*EmailScope) Unmarshal added in v1.1.0

func (s *EmailScope) Unmarshal(data []byte) error

type QuotaContent added in v1.1.0

type QuotaContent struct {
	ResetTraffic bool   `json:"reset_traffic"`        // whether to reset traffic
	Days         uint64 `json:"days,omitempty"`       // days to add
	GiftType     uint8  `json:"gift_type,omitempty"`  // 1: Fixed, 2: Ratio
	GiftValue    uint64 `json:"gift_value,omitempty"` // value of the gift type
}

func (*QuotaContent) Marshal added in v1.1.0

func (c *QuotaContent) Marshal() ([]byte, error)

func (*QuotaContent) Unmarshal added in v1.1.0

func (c *QuotaContent) Unmarshal(data []byte) error

type QuotaScope added in v1.1.0

type QuotaScope struct {
	Subscribers []int64 `json:"subscribers"` // Subscribe IDs
	IsActive    *bool   `json:"is_active"`   // filter by active status
	StartTime   int64   `json:"start_time"`  // filter by subscription start time
	EndTime     int64   `json:"end_time"`    // filter by subscription end time
	Objects     []int64 `json:"recipients"`  // list of user subs IDs
}

func (*QuotaScope) Marshal added in v1.1.0

func (s *QuotaScope) Marshal() ([]byte, error)

func (*QuotaScope) Unmarshal added in v1.1.0

func (s *QuotaScope) Unmarshal(data []byte) error

type ScopeType added in v1.1.0

type ScopeType int8
const (
	ScopeAll     ScopeType = iota + 1 // All users
	ScopeActive                       // Active users
	ScopeExpired                      // Expired users
	ScopeNone                         // No Subscribe
	ScopeSkip                         // Skip user filtering
)

func ParseScopeType added in v1.1.0

func ParseScopeType(t int8) ScopeType

func (ScopeType) Int8 added in v1.1.0

func (t ScopeType) Int8() int8

type Task added in v1.1.0

type Task struct {
	Id        int64     `gorm:"primaryKey;autoIncrement;comment:ID"`
	Type      int8      `gorm:"not null;comment:Task Type"`
	Scope     string    `gorm:"type:text;comment:Task Scope"`
	Content   string    `gorm:"type:text;comment:Task Content"`
	Status    int8      `gorm:"not null;default:0;comment:Task Status: 0: Pending, 1: In Progress, 2: Completed, 3: Failed"`
	Errors    string    `gorm:"type:text;comment:Task Errors"`
	Total     uint64    `gorm:"column:total;not null;default:0;comment:Total Number"`
	Current   uint64    `gorm:"column:current;not null;default:0;comment:Current Number"`
	CreatedAt time.Time `gorm:"<-:create;comment:Creation Time"`
	UpdatedAt time.Time `gorm:"comment:Update Time"`
}

func (Task) TableName added in v1.1.0

func (Task) TableName() string

type Type added in v1.1.0

type Type int8

Jump to

Keyboard shortcuts

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