progress

package
v0.1.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package progress provides progress reporting and performance metrics for batch operations.

This package implements intelligent progress reporting with:

  • TTY detection for appropriate progress bar display
  • Debug mode compatibility (text updates instead of progress bars)
  • Real-time performance metrics (emails/second, success rate, ETA)
  • Automatic fallback for non-interactive environments
  • Performance statistics collection and reporting
  • Integration with logging system for debug information

The Reporter automatically adapts its output based on the environment, showing progress bars in interactive terminals and periodic text updates in non-interactive or debug modes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShowMetrics

func ShowMetrics(stats Stats, output io.Writer)

ShowMetrics displays performance metrics

Types

type Reporter

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

Reporter handles progress reporting for batch operations

func NewReporter

func NewReporter(total int, showProgress, debugMode bool) *Reporter

NewReporter creates a new progress reporter

func (*Reporter) Finish

func (r *Reporter) Finish() Stats

Finish completes the progress reporting and returns stats

func (*Reporter) Start

func (r *Reporter) Start()

Start initializes the progress reporter

func (*Reporter) Update

func (r *Reporter) Update(success bool)

Update reports progress for a single message result

type Stats

type Stats struct {
	Total        int           `json:"total"`
	Sent         int           `json:"sent"`
	Failed       int           `json:"failed"`
	SuccessRate  float64       `json:"success_rate"`
	Duration     time.Duration `json:"duration"`
	EmailsPerSec float64       `json:"emails_per_sec"`
}

Stats holds performance metrics

Jump to

Keyboard shortcuts

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