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

task

package
v1.15.19 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 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

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

func (*EmailContent) Marshal

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

func (*EmailContent) Unmarshal

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

type EmailScope

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

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

func (*EmailScope) Unmarshal

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

type Filter

type Filter struct {
	Type   Type
	Page   int
	Size   int
	Status *uint8
	Scope  *int8
}

Filter task 列表查询过滤条件

type QuotaContent

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

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

func (*QuotaContent) Unmarshal

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

type QuotaScope

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

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

func (*QuotaScope) Unmarshal

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

type ScopeType

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

func ParseScopeType(t int8) ScopeType

func (ScopeType) Int8

func (t ScopeType) Int8() int8

type Task

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

func (Task) TableName() string

type Type

type Type int8

Jump to

Keyboard shortcuts

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