Documentation
¶
Overview ¶
Package bar provides functionality for progress bar rendering.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bar ¶
type Bar interface {
// Progress returns write channel, that will increase done work.
Progress() chan<- struct{}
// Finish stops the progress bar, means that no work left to do. Should be called in defer after bar created.
Finish()
// Run runs progress bar rendering. Blocking process, should be run in a goroutine.
Run(ctx context.Context)
}
Bar is a progress bar manipulation contract.
func New ¶
New creates Bar instance for bar progress rendering. max - is the expected amount of work. barType - is a desired type of bar that constructor will return. Usage:
pBar := bar.New(len(notMutual), log.GetLevel())
go pBar.Run(ctx)
defer func() {
pBar.Finish()
}()
for i := range 100{
pBar.Progress() <- struct{}{}
}.
Click to show internal directories.
Click to hide internal directories.