domain

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactIn

type ArtifactIn struct {
	Name          string `json:"name" binding:"required"`
	URL           string `json:"url,omitempty"`
	ContentBase64 string `json:"contentBase64,omitempty"`
	ContentType   string `json:"contentType,omitempty"`
}

type ArtifactOut

type ArtifactOut struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Command

type Command string
const (
	CmdGenerateMaster   Command = "GENERATE_MASTER"
	CmdGenerateCreative Command = "GENERATE_CREATIVE"
)

func (Command) MarshalBinary

func (c Command) MarshalBinary() ([]byte, error)

func (Command) MarshalText

func (c Command) MarshalText() ([]byte, error)

type QueueStats

type QueueStats struct {
	Command    Command `json:"command"`
	Ready      int64   `json:"ready"`
	Delayed    int64   `json:"delayed"`
	InProgress int64   `json:"inProgress"`
	DLQ        int64   `json:"dlq"`
}

type ResultRecord

type ResultRecord struct {
	TaskID      string         `json:"taskId"`
	Status      TaskStatus     `json:"status"`
	Result      map[string]any `json:"result,omitempty"`
	Error       string         `json:"error,omitempty"`
	Artifacts   []ArtifactOut  `json:"artifacts,omitempty"`
	CompletedAt time.Time      `json:"completedAt"`
}

type SubmitResultRequest

type SubmitResultRequest struct {
	WorkerID  string         `json:"workerId,omitempty"`
	Status    TaskStatus     `json:"status" binding:"required"`
	Result    map[string]any `json:"result,omitempty"`
	Error     string         `json:"error,omitempty"`
	Artifacts []ArtifactIn   `json:"artifacts,omitempty"`
}

type Subscription

type Subscription struct {
	ID                 string    `json:"id"`
	CallbackURL        string    `json:"callbackUrl"`
	EventTypes         []Command `json:"eventTypes"`
	DeliveryMode       string    `json:"deliveryMode"`
	GroupID            string    `json:"groupId,omitempty"`
	MinIntervalSeconds int       `json:"minIntervalSeconds"`
	ExpiresAt          time.Time `json:"expiresAt"`
	CreatedAt          time.Time `json:"createdAt"`
}

type Task

type Task struct {
	ID          string     `json:"id"`
	Command     Command    `json:"command"`
	Payload     string     `json:"payload"` // JSON string opaco
	Priority    int        `json:"priority,omitempty"`
	Webhook     string     `json:"webhook,omitempty"`
	Status      TaskStatus `json:"status"`
	WorkerID    string     `json:"workerId,omitempty"`
	LeaseUntil  string     `json:"leaseUntil,omitempty"` // RFC3339
	Attempts    int        `json:"attempts,omitempty"`
	MaxAttempts int        `json:"maxAttempts,omitempty"`
	Error       string     `json:"error,omitempty"`
	ResultKey   string     `json:"resultKey,omitempty"`
	CreatedAt   time.Time  `json:"createdAt"`
	UpdatedAt   time.Time  `json:"updatedAt"`
}

type TaskStatus

type TaskStatus string
const (
	StatusPending    TaskStatus = "PENDING"
	StatusInProgress TaskStatus = "IN_PROGRESS"
	StatusCompleted  TaskStatus = "COMPLETED"
	StatusFailed     TaskStatus = "FAILED"
)

func (TaskStatus) MarshalBinary

func (s TaskStatus) MarshalBinary() ([]byte, error)

func (TaskStatus) MarshalText

func (s TaskStatus) MarshalText() ([]byte, error)

Jump to

Keyboard shortcuts

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