progress

package
v0.0.0-...-b425644 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HumanReadable

func HumanReadable(p *Progress)

func IntLen

func IntLen(i int) int

func SizePretty

func SizePretty(raw float64) string

Types

type LogPrinter

type LogPrinter struct {
	HumanReadable bool
	Logger        Logger
}

func (*LogPrinter) Print

func (p *LogPrinter) Print(s *Status)

type Logger

type Logger interface {
	Printf(string, ...interface{})
}
var DefaultLogger Logger = log.New(os.Stderr, "", 0)

type Printer

type Printer interface {
	Print(*Status)
}

type Progress

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

func Start

func Start(l Logger, funcs ...func(*Progress)) *Progress

func (*Progress) Close

func (p *Progress) Close() error

func (*Progress) Diff

func (p *Progress) Diff() time.Duration

func (*Progress) Inc

func (p *Progress) Inc()

func (*Progress) IncBy

func (p *Progress) IncBy(i int)

func (*Progress) Reset

func (p *Progress) Reset()

func (*Progress) Start

func (p *Progress) Start()

func (*Progress) Status

func (p *Progress) Status() *Status

func (*Progress) Write

func (p *Progress) Write(b []byte) (int, error)

type StartFunc

type StartFunc func(*Progress)

func WithPrinter

func WithPrinter(printer Printer) StartFunc

func WithTotal

func WithTotal(total int) StartFunc

type Status

type Status struct {
	Started  time.Time
	Now      time.Time
	Current  int
	MemStats runtime.MemStats
	Total    *int
}

func (*Status) ETA

func (s *Status) ETA() *time.Duration

func (*Status) PerSecond

func (s *Status) PerSecond() float64

func (*Status) RunningSince

func (s *Status) RunningSince() time.Duration

func (*Status) String

func (status *Status) String() string

type Writer

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

func NewWriter

func NewWriter() *Writer

func NewWriterWithTotal

func NewWriterWithTotal(total int64) *Writer

func (*Writer) Close

func (p *Writer) Close() error

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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