report

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidGeneratorType indicates that the specified generator type is invalid.
	ErrInvalidGeneratorType = errors.New("Invalid generator type")
	// ErrInvalidConfiguration indicates that the supplied configuration is invalid.
	ErrInvalidConfiguration = errors.New("Invalid configuration")
)
View Source
var (
	// ErrInvalidRequest indicates that the request format is invalid.
	ErrInvalidRequest = errors.New("Invalid request")
	// ErrUnsupportedReportType indicates that the specified report type is not supported.
	ErrUnsupportedReportType = errors.New("The requested report type is not supported")
)

Functions

func NewProcessor

func NewProcessor(log *log.Logger, generateUCC map[model.ReportType]GenerateUC,
	notifier notify.Notifier, metricsClient metrics.Client) (queue.Processor, error)

NewProcessor builds and returns a new Reports Processor.

Types

type GenerateUC

type GenerateUC interface {
	// Generate generates the report based on request data.
	Generate(ctx context.Context, teamInfo teamInfo, reportData interface{}) (model.Report, error)
	// Finish finishes report generation updating its status.
	Finish(ctx context.Context, reportID, status string) error
}

GenerateUC represents the Use Case interface for a report generation.

func NewGenerateUC

func NewGenerateUC(typ model.ReportType, logger *log.Logger, generator Generator, repository storage.ReportsRepository) (GenerateUC, error)

NewGenerateUC creates a new report generate use case based on specified type.

type Generator

type Generator interface {
	Generate(ctx context.Context, teamInfo teamInfo, reportData interface{}) (interface{}, error)
}

Generator represents the interface for a report generator.

func NewGenerator

func NewGenerator(typ string, config interface{}, log *log.Logger, db *sql.DB) (Generator, error)

NewGenerator builds and returns a new generator for the specified type.

Jump to

Keyboard shortcuts

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