Files
taskqueue-server/models/task.go
2025-12-29 11:04:28 +00:00

25 lines
1.2 KiB
Go
Executable File

package models
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type Task struct {
ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`
ApplicationId string `bson:"applicationId,omitempty" json:"applicationId"`
EventId string `bson:"eventId,omitempty" json:"eventId"`
Payload interface{} `bson:"payload,omitempty" json:"payload"`
Priority int `bson:"priority,omitempty" json:"priority"` // higher first
AvailableAt time.Time `bson:"availableAt,omitempty" json:"availableAt"`
Status string `bson:"status,omitempty" json:"status"`
LeaseOwner string `bson:"leaseOwner,omitempty" json:"leaseOwner"`
LeasedUntil time.Time `bson:"leasedUntil,omitempty" json:"leasedUntil"`
Attempts int `bson:"attempts,omitempty" json:"attempts"`
MaxAttempts int `bson:"maxAttempts,omitempty" json:"maxAttempts"`
CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt"`
Errors []string `bson:"errors,omitempty" json:"errors,omitempty"`
}