reporting

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package reporting provides functionality for generating reports of template execution results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReportData

type ReportData struct {
	// GeneratedAt is the time the report was generated
	GeneratedAt time.Time `json:"generated_at"`
	// Summary is the summary of the report
	Summary ReportSummary `json:"summary"`
	// Results is the list of template execution results
	Results []*interfaces.TemplateResult `json:"results"`
}

ReportData represents the data for a report

type ReportFormat

type ReportFormat string

ReportFormat represents the format of a report

const (
	// JSONFormat represents a JSON report
	JSONFormat ReportFormat = "json"
	// YAMLFormat represents a YAML report
	YAMLFormat ReportFormat = "yaml"
	// HTMLFormat represents an HTML report
	HTMLFormat ReportFormat = "html"
	// PDFFormat represents a PDF report
	PDFFormat ReportFormat = "pdf"
	// ExcelFormat represents an Excel report
	ExcelFormat ReportFormat = "excel"
	// CSVFormat represents a CSV report
	CSVFormat ReportFormat = "csv"
)

type ReportFormatter

type ReportFormatter func(results []*interfaces.TemplateResult) ([]byte, error)

ReportFormatter is a function that formats a report

type ReportSummary

type ReportSummary struct {
	// TotalTemplates is the total number of templates executed
	TotalTemplates int `json:"total_templates"`
	// SuccessfulTemplates is the number of templates that completed successfully
	SuccessfulTemplates int `json:"successful_templates"`
	// FailedTemplates is the number of templates that failed
	FailedTemplates int `json:"failed_templates"`
	// VulnerabilitiesDetected is the number of vulnerabilities detected
	VulnerabilitiesDetected int `json:"vulnerabilities_detected"`
	// AverageScore is the average score of all templates
	AverageScore float64 `json:"average_score"`
	// AverageDuration is the average duration of all templates
	AverageDuration time.Duration `json:"average_duration"`
	// TotalDuration is the total duration of all templates
	TotalDuration time.Duration `json:"total_duration"`
}

ReportSummary represents the summary of a report

type TemplateReporter

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

TemplateReporter is responsible for generating reports of template execution results

func NewTemplateReporter

func NewTemplateReporter() (*TemplateReporter, error)

NewTemplateReporter creates a new template reporter

func (*TemplateReporter) GenerateReport

func (r *TemplateReporter) GenerateReport(results []*interfaces.TemplateResult, format string) ([]byte, error)

GenerateReport generates a report for template execution results

func (*TemplateReporter) RegisterCustomFormatter

func (r *TemplateReporter) RegisterCustomFormatter(format ReportFormat, formatter ReportFormatter)

RegisterCustomFormatter registers a custom formatter for a specific report format

func (*TemplateReporter) SetHTMLTemplate

func (r *TemplateReporter) SetHTMLTemplate(htmlTemplate string) error

SetHTMLTemplate sets the HTML template for reports

Jump to

Keyboard shortcuts

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