types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyOpts = &Opts{}

Functions

This section is empty.

Types

type ConsumerFn

type ConsumerFn func(ctx context.Context, payload PayloadInput) error

consumer

type ConsumerInput

type ConsumerInput interface {
	UpFn(ctx context.Context, payload PayloadInput) error
	DownFn(ctx context.Context, payload PayloadInput) error
	GetConfig() Opts
	GetEventName() string
}

type EventType

type EventType string
const (
	EventTypeSaga EventType = "saga"
	EventTypeTask EventType = "task"
)

type Fn

type Fn func(ctx context.Context, payload PayloadInput) error

type Logger

type Logger interface {
	Info(msg string, keysAndValues ...interface{})
	Error(msg string, keysAndValues ...interface{})
	Debug(msg string, keysAndValues ...interface{})
	Warn(msg string, keysAndValues ...interface{})
}

type Opts

type Opts struct {
	Kind                 string        `json:"kind"`
	MaxRetry             int           `json:"retry"`
	Delay                time.Duration `json:"timout"`
	MaxTimeOfProcessTask time.Duration `json:"max_time_of_process_task"`
	DeadLine             time.Time     `json:"dead_line"`
	Queue                string        `json:"queue"`
	Unique               time.Duration `json:"unique"`
}

Opts

type PayloadInput

type PayloadInput struct {
	EventID   uuid.UUID `json:"event_id"`
	Data      []byte    `json:"payload"`
	CreatedAt time.Time `json:"created_at"`
}

func (PayloadInput) Parser

func (p PayloadInput) Parser(v any) error

type PayloadType

type PayloadType struct {
	TransactionEventID uuid.UUID      `json:"transaction_event_id"`
	EventID            uuid.UUID      `json:"event_id"`
	Payload            PayloadInput   `json:"payload"`
	EventName          string         `json:"event_name"`
	EventsNames        []string       `json:"events_names"`
	Opts               Opts           `json:"opts"`
	Info               map[string]any `json:"info"`
	Type               EventType      `json:"type"`
	CreatedAt          time.Time      `json:"created_at"`
}

type Producer

type Producer interface {
	Producer(ctx context.Context, input PayloadType) error
	Close()
	GenerateEventID() uuid.UUID
}

type ProducerFn

type ProducerFn func(ctx context.Context) error

producer

type Repository

type Repository interface {
	UpdateInfos(ctx context.Context, txID uuid.UUID, retry int, status string) error
	SaveTx(ctx context.Context, input PayloadType) error
	SagaUpdateInfos(ctx context.Context, txID uuid.UUID, retry int, status string) error
	SagaSaveTx(ctx context.Context, input PayloadType) error
	Close()
}

Repository defines the methods that the Client struct must implement

type TimeProvider

type TimeProvider interface {
	Now() time.Time
}

type UpdatePayloadInput

type UpdatePayloadInput struct {
	Status     string    `json:"status"`
	TotalRetry int       `json:"total_retry"`
	FinishedAt time.Time `json:"finished_at"`
}

Jump to

Keyboard shortcuts

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