types

package
v0.0.0-...-d85f02a Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cursor

type Cursor struct {
	ProcessName string `json:"process_name,omitempty" db:"process_name"`
	Position    int64  `json:"position,omitempty"     db:"position"`
}

type Option

type Option struct {
	DB *sqlx.DB
}

type Outbox

type Outbox struct {
	ID          int64     `json:"id,omitempty"           db:"id"`
	ProcessName string    `json:"process_name,omitempty" db:"process_name"`
	Body        []byte    `json:"body,omitempty"         db:"body"`
	CreatedAt   time.Time `json:"created_at,omitempty"   db:"created_at"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"   db:"updated_at"`
}

type Storager

type Storager interface {
	Init(option *Option)
	UpsertCursor(ctx context.Context, cursor Cursor) error
	AddMessage(ctx context.Context, tx *sqlx.Tx, message Outbox) error
	GetPositionWithLock(ctx context.Context, processName string) (int64, error)
	SetPosition(ctx context.Context, processName string, position int64) error
	GetMessagesFromPos(
		ctx context.Context,
		processName string,
		position int64,
		limit int,
	) ([]Outbox, error)
}
var CurrentStorage Storager

func GetStorager

func GetStorager() Storager

Jump to

Keyboard shortcuts

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