reporter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedFormats

func AllowedFormats() map[string]core.Reporter

AllowedFormats creates a map with the allowed report formats and their implementations

func AllowedFormatsCollection

func AllowedFormatsCollection() []string

AllowedFormatsCollection returns the collection of allowed formats

func CreateReporter

func CreateReporter(format string) core.Reporter

CreateReporter creates a new reporter

func IsAllowedFormat

func IsAllowedFormat(format string) bool

IsAllowedFormat returns true if the format is allowed

Types

type CliReporter

type CliReporter struct {
	Period         core.Period
	Repo           core.ActivityRepository
	Printer        func(...interface{}) (int, error)
	DurationFormat core.DurationFormat
}

CliReporter is an activity reporter that presents activity information in the standard out

func NewCliReporter

func NewCliReporter() *CliReporter

NewCliReporter creates a new CLI reporter

func NewCustomCLIReporter

func NewCustomCLIReporter(printer func(...interface{}) (int, error)) *CliReporter

NewCustomCLIReporter creates a new CLI reporter

func (*CliReporter) Initialize

func (reporter *CliReporter) Initialize(repo core.ActivityRepository, period core.Period) error

Initialize initializes a new CLI reporter

func (*CliReporter) ProduceReport

func (reporter *CliReporter) ProduceReport() error

ProduceReport creates a new cli report in the given period

func (*CliReporter) SetDurationFormat

func (reporter *CliReporter) SetDurationFormat(f core.DurationFormat)

SetDurationFormat sets the duration formatter

type CsvReporter

type CsvReporter struct {
	Period         core.Period
	Repo           core.ActivityRepository
	DurationFormat core.DurationFormat
	Clock          utils.Clock
}

CsvReporter is an activity reporter that exports activity information to a csv file.

func NewCsvReporter

func NewCsvReporter() *CsvReporter

NewCsvReporter creates a new CSV reporter

func (*CsvReporter) Initialize

func (reporter *CsvReporter) Initialize(repo core.ActivityRepository, period core.Period) error

Initialize initializes a new CSV reporter

func (*CsvReporter) ProduceReport

func (reporter *CsvReporter) ProduceReport() error

ProduceReport creates a new CSV report in the given period

func (*CsvReporter) SetDurationFormat

func (reporter *CsvReporter) SetDurationFormat(f core.DurationFormat)

SetDurationFormat sets the duration formatter

type EmptyReporter

type EmptyReporter struct{}

EmptyReporter represents a reporter not supported

func NewEmptyReporter

func NewEmptyReporter() *EmptyReporter

NewEmptyReporter creates a new empty reporter

func (*EmptyReporter) Initialize

func (reporter *EmptyReporter) Initialize(repo core.ActivityRepository, period core.Period) error

Initialize initializes a new empty reporter

func (*EmptyReporter) ProduceReport

func (reporter *EmptyReporter) ProduceReport() error

ProduceReport no-op

func (*EmptyReporter) SetDurationFormat

func (reporter *EmptyReporter) SetDurationFormat(f core.DurationFormat)

SetDurationFormat no-op

type JsonReporter

type JsonReporter struct {
	Period         core.Period
	Repo           core.ActivityRepository
	DurationFormat core.DurationFormat
	Clock          utils.Clock
}

JsonReporter is an activity reporter that exports activity information to a json file.

func NewJsonReporter

func NewJsonReporter() *JsonReporter

NewJsonReporter creates a new JSON reporter

func (*JsonReporter) Initialize

func (reporter *JsonReporter) Initialize(repo core.ActivityRepository, period core.Period) error

Initialize initializes a new JSON reporter

func (*JsonReporter) ProduceReport

func (reporter *JsonReporter) ProduceReport() error

ProduceReport creates a new json report in the given period

func (*JsonReporter) SetDurationFormat

func (reporter *JsonReporter) SetDurationFormat(f core.DurationFormat)

SetDurationFormat sets the duration formatter

Jump to

Keyboard shortcuts

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