outbox

package
v0.0.0-...-02b068e Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts func(*Outbox) error

func WithBatchSize

func WithBatchSize(batchSize int) Opts

func WithProducer

func WithProducer(producer sarama.SyncProducer) Opts

func WithWorkerCount

func WithWorkerCount(workerCount int) Opts

type Outbox

type Outbox struct {
	// contains filtered or unexported fields
}

func NewPub

func NewPub(db *pg.DB, opt ...Opts) *Outbox

func (*Outbox) Close

func (p *Outbox) Close()

func (*Outbox) Save

func (p *Outbox) Save(topic string, key string, data []byte) error

func (*Outbox) Start

func (p *Outbox) Start(ctx context.Context)

func (*Outbox) Stop

func (p *Outbox) Stop()

type Outboxes

type Outboxes struct {
	ID          string                 `pg:"id,type:uuid,default:uuid_generate_v4(),pk"`
	Payload     map[string]interface{} `pg:"type:jsonb,notnull"`
	Key         string                 `pg:"type:varchar(255)"`
	IsDeliver   bool                   `pg:"type:bool,notnull,default:false"`
	Topic       string                 `pg:"type:varchar(255),notnull"`
	CreatedAt   time.Time              `pg:"type:timestamptz,default:now()"`
	ProcessedAt time.Time              `pg:"type:timestamptz,default:null"`
	CreatedBy   string                 `pg:"type:varchar(255)"`
	UpdatedAt   time.Time              `pg:"type:timestamptz,default:now()"`
	UpdatedBy   string                 `pg:"type:varchar(255)"`
}

Jump to

Keyboard shortcuts

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