trackerbun

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package trackerbun provides Bun-backed progress tracking for go-export.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

type Tracker struct {
	DB *bun.DB

	Now         func() time.Time
	IDGenerator func() string
	// contains filtered or unexported fields
}

Tracker stores export progress in a Bun-backed database.

func NewTracker

func NewTracker(db *bun.DB) *Tracker

NewTracker creates a Bun-backed tracker.

func (*Tracker) Advance

func (t *Tracker) Advance(ctx context.Context, id string, delta export.ProgressDelta, meta map[string]any) error

Advance updates counts for an export.

func (*Tracker) Complete

func (t *Tracker) Complete(ctx context.Context, id string, meta map[string]any) error

Complete marks the export as completed.

func (*Tracker) Delete

func (t *Tracker) Delete(ctx context.Context, id string) error

Delete removes a record from the tracker.

func (*Tracker) Fail

func (t *Tracker) Fail(ctx context.Context, id string, err error, meta map[string]any) error

Fail marks the export as failed.

func (*Tracker) List

List returns records matching a filter.

func (*Tracker) SetArtifact

func (t *Tracker) SetArtifact(ctx context.Context, id string, ref export.ArtifactRef) error

SetArtifact updates the artifact metadata for a record.

func (*Tracker) SetState

func (t *Tracker) SetState(ctx context.Context, id string, state export.ExportState, meta map[string]any) error

SetState updates the export state.

func (*Tracker) Start

func (t *Tracker) Start(ctx context.Context, record export.ExportRecord) (string, error)

Start creates a new export record.

func (*Tracker) Status

func (t *Tracker) Status(ctx context.Context, id string) (export.ExportRecord, error)

Status returns a record by ID.

func (*Tracker) Update

func (t *Tracker) Update(ctx context.Context, record export.ExportRecord) error

Update replaces an export record.

func (*Tracker) WithTx added in v0.10.0

func (t *Tracker) WithTx(tx bun.Tx) *Tracker

WithTx binds every tracker operation to the caller-owned transaction.

Jump to

Keyboard shortcuts

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