format

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NanosecondsPerMillisecond is the number of nanoseconds in a millisecond.
	NanosecondsPerMillisecond = 1e6
)

Duration formatting constants.

Variables

This section is empty.

Functions

func Bytes

func Bytes(bytes int64) string

Bytes formats bytes for display (alias for Size for consistency).

func CleanResultsToJSON

func CleanResultsToJSON(
	results map[string]domain.CleanResult, duration time.Duration,
	dryRun bool, skipped, failed map[string]error,
) ([]byte, error)

CleanResultsToJSON converts clean results to JSON output format.

func Date

func Date(t time.Time) string

Date formats date for human reading.

func DateTime

func DateTime(t time.Time) string

DateTime formats date and time for human reading.

func Duration

func Duration(d time.Duration) string

Duration formats duration for human reading.

func Number

func Number(n int64) string

Number formats number with thousand separators.

func Size

func Size(bytes int64) string

Size formats bytes for human reading using IEC binary prefixes.

Types

type CleanerResult

type CleanerResult struct {
	Name         string `json:"name"`
	ItemsRemoved uint   `json:"items_removed"`
	ItemsFailed  uint   `json:"items_failed"`
	FreedBytes   uint64 `json:"freed_bytes"`
	FreedHuman   string `json:"freed_human"`
	Status       string `json:"status"` // "success", "skipped", "failed"
	Error        string `json:"error,omitempty"`
}

CleanerResult represents individual cleaner results in JSON output.

type JSONOutput

type JSONOutput struct {
	Success      bool            `json:"success"`
	CleanedAt    time.Time       `json:"cleaned_at"`
	DurationMs   int64           `json:"duration_ms"`
	ItemsRemoved uint            `json:"items_removed"`
	ItemsFailed  uint            `json:"items_failed"`
	FreedBytes   uint64          `json:"freed_bytes"`
	FreedHuman   string          `json:"freed_human"`
	Cleaners     []CleanerResult `json:"cleaners"`
	DryRun       bool            `json:"dry_run,omitempty"`
	Errors       []string        `json:"errors,omitempty"`
}

JSONOutput represents the JSON structure for clean command output.

Jump to

Keyboard shortcuts

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