statushooks

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullHooks = &NullStatusHook{}
View Source
var NullProgress = &NullSnapshotProgress{}

NullProgress is an empty implementation of SnapshotProgress

Functions

func AddMessageRendererToContext added in v0.16.0

func AddMessageRendererToContext(ctx context.Context, messageRenderer MessageRenderer) context.Context

func AddSnapshotProgressToContext added in v0.17.0

func AddSnapshotProgressToContext(ctx context.Context, snapshotProgress SnapshotProgress) context.Context

func AddStatusHooksToContext

func AddStatusHooksToContext(ctx context.Context, statusHooks StatusHooks) context.Context

func DisableStatusHooks

func DisableStatusHooks(ctx context.Context) context.Context

func Done

func Done(ctx context.Context)

func Message

func Message(ctx context.Context, msgs ...string)

func SetStatus

func SetStatus(ctx context.Context, msg string)

func SnapshotError added in v0.17.0

func SnapshotError(ctx context.Context)

func UpdateSnapshotProgress added in v0.17.0

func UpdateSnapshotProgress(ctx context.Context, completedRows int)

Types

type MessageRenderer added in v0.16.0

type MessageRenderer func(format string, a ...any)

func MessageRendererFromContext added in v0.16.0

func MessageRendererFromContext(ctx context.Context) MessageRenderer

type NullSnapshotProgress added in v0.17.0

type NullSnapshotProgress struct{}

func (*NullSnapshotProgress) UpdateErrorCount added in v0.17.0

func (*NullSnapshotProgress) UpdateErrorCount(context.Context, int)

func (*NullSnapshotProgress) UpdateRowCount added in v0.17.0

func (*NullSnapshotProgress) UpdateRowCount(context.Context, int)

type NullStatusHook

type NullStatusHook struct{}

func (*NullStatusHook) Done

func (*NullStatusHook) Done()

func (*NullStatusHook) Message

func (*NullStatusHook) Message(...string)

func (*NullStatusHook) SetStatus

func (*NullStatusHook) SetStatus(string)

type SnapshotProgress added in v0.17.0

type SnapshotProgress interface {
	UpdateRowCount(context.Context, int)
	UpdateErrorCount(context.Context, int)
}

func SnapshotProgressFromContext added in v0.17.0

func SnapshotProgressFromContext(ctx context.Context) SnapshotProgress

type SnapshotProgressReporter added in v0.17.0

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

SnapshotProgressReporter is an implementation of SnapshotProgress

func NewSnapshotProgressReporter added in v0.17.0

func NewSnapshotProgressReporter(target string) *SnapshotProgressReporter

func (*SnapshotProgressReporter) UpdateErrorCount added in v0.17.0

func (r *SnapshotProgressReporter) UpdateErrorCount(ctx context.Context, errors int)

func (*SnapshotProgressReporter) UpdateRowCount added in v0.17.0

func (r *SnapshotProgressReporter) UpdateRowCount(ctx context.Context, rows int)

type StatusHooks

type StatusHooks interface {
	SetStatus(string)
	Done()
	Message(...string)
}

func StatusHooksFromContext

func StatusHooksFromContext(ctx context.Context) StatusHooks

Jump to

Keyboard shortcuts

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