Documentation
¶
Index ¶
Constants ¶
View Source
const ( OutboxStatusPending = "pending" OutboxStatusSent = "sent" OutboxStatusFailed = "failed" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GormOutbox ¶
type GormOutbox struct {
// contains filtered or unexported fields
}
func NewGormOutbox ¶
func NewGormOutbox(db *gorm.DB, client corequeue.Client) *GormOutbox
func (*GormOutbox) SaveBatch ¶
func (o *GormOutbox) SaveBatch(ctx context.Context, tasks ...corequeue.OutboxTask) error
type OutboxRecord ¶
type OutboxRecord struct {
ID uint64 `json:"id" gorm:"primaryKey;autoIncrement;comment:主键"`
TaskID string `json:"task_id" gorm:"column:task_id;size:191;index;comment:任务ID"`
Queue string `json:"queue" gorm:"column:queue;size:64;not null;index:idx_queue_outbox_status_available,priority:2;comment:队列"`
Type string `json:"type" gorm:"column:type;size:191;not null;index;comment:任务类型"`
Payload datatypes.JSON `json:"payload" gorm:"column:payload;type:jsonb;not null;comment:任务载荷"`
Headers datatypes.JSON `json:"headers" gorm:"column:headers;type:jsonb;not null;default:'{}'::jsonb;comment:任务头"`
Options datatypes.JSON `json:"options" gorm:"column:options;type:jsonb;not null;default:'{}'::jsonb;comment:投递选项"`
Status string `json:"status" gorm:"column:status;size:32;not null;index:idx_queue_outbox_status_available,priority:1;comment:状态"`
Attempts int `json:"attempts" gorm:"column:attempts;not null;default:0;comment:投递尝试次数"`
LastError string `json:"last_error" gorm:"column:last_error;type:text;comment:最后错误"`
AvailableAt time.Time `` /* 130-byte string literal not displayed */
SentAt *time.Time `json:"sent_at" gorm:"column:sent_at;comment:投递成功时间"`
CreatedAt time.Time `json:"created_at,omitempty" gorm:"column:created_at;comment:创建时间"`
UpdatedAt time.Time `json:"updated_at,omitempty" gorm:"column:updated_at;comment:更新时间"`
}
func (OutboxRecord) TableName ¶
func (OutboxRecord) TableName() string
Click to show internal directories.
Click to hide internal directories.