event

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetadataRetryCount    string = "retry_count"
	MetadataRetryLimit    string = "retry_limit"
	MetadataLastError     string = "last_error"
	MetadataLastAttempt   string = "last_attempt"
	MetadataArchiveReason string = "archive_reason"
)

Variables

This section is empty.

Functions

func UUIDv7

func UUIDv7() string

Types

type Event

type Event interface {
	GetID() string

	Marshal() (json.RawMessage, error)

	Unmarshal(json.RawMessage) error
}

type EventType

type EventType string
const (
	TypeSubmit EventType = "submit"
)

func (EventType) String

func (s EventType) String() string

type Metadata

type Metadata map[string]string

type Status

type Status string
const (
	StatusLost     Status = "lost"
	StatusPending  Status = "pending"
	StatusRunning  Status = "running"
	StatusComplete Status = "complete"
	StatusFailed   Status = "failed"
	StatusRetry    Status = "retry"
	StatusArchived Status = "archived"
)

func (Status) IsTerminal

func (s Status) IsTerminal() bool

func (Status) String

func (s Status) String() string

type StatusEvent

type StatusEvent struct {
	ID       string          `json:"id"`
	Time     time.Time       `json:"time,omitempty"`
	Status   Status          `json:"status"`
	Payload  json.RawMessage `json:"payload,omitempty"`
	Metadata Metadata        `json:"metadata,omitempty"`
}

func (*StatusEvent) GetID

func (ev *StatusEvent) GetID() string

func (*StatusEvent) Marshal

func (ev *StatusEvent) Marshal() (json.RawMessage, error)

func (*StatusEvent) Unmarshal

func (ev *StatusEvent) Unmarshal(data json.RawMessage) error

type SubmitEvent

type SubmitEvent struct {
	ID       string          `json:"id"`
	Time     time.Time       `json:"time,omitempty"`
	Type     EventType       `json:"type,omitempty"`
	Payload  json.RawMessage `json:"payload,omitempty"`
	Metadata Metadata        `json:"metadata,omitempty"`
}

func (*SubmitEvent) GetID

func (ev *SubmitEvent) GetID() string

func (*SubmitEvent) Marshal

func (ev *SubmitEvent) Marshal() (json.RawMessage, error)

func (*SubmitEvent) Unmarshal

func (ev *SubmitEvent) Unmarshal(data json.RawMessage) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳