files

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package files provides types and functions related to the various files created by this application.

Index

Constants

View Source
const ReportFileOpenFlags int = os.O_APPEND | os.O_CREATE | os.O_WRONLY

ReportFileOpenFlags is configured to create report files in append-only write mode. This works well when writing all report data to a single file and works fairly well when writing to separate files, one per account name. One potential side-effect is that multiple executions of the application can result in appended reports instead of separate reports due to how we are currently using date/time based naming patterns. If this becomes a problem, we should update this flag set to overwrite any existing contents so that only the latest execution of the application (within the same minute) is reflected within the report file.

View Source
const ReportFilenameDateLayout string = "2006-01-02-15_04"

ReportFilenameDateLayout is the time formatting layout for generated reports.

View Source
const ReportFilenameTemplate string = "%s-emails-report-%s.txt"

ReportFilenameTemplate is used as a filename template when generating new email check report files. This file is appended to for each account processed. In order to help prevent repeatedly writing to the same report the current date/time when first writing to the file is used as part of the filename itself.

Variables

This section is empty.

Functions

func GenerateReport

func GenerateReport(reportData ReportData, reportDirectory string, logger zerolog.Logger) error

GenerateReport is a wrapper around the steps needed for generating or updating a email summary report. This function receives a ReportData type that acts as a container for all required information used by the report generation process and the path to a directory that will hold generated reports.

Types

type ReportData

type ReportData struct {

	// AccountName is the name of the email account that was processed. This
	// matches the section name used in the configuration file.
	AccountName string

	// MailboxCheckResults provides the final state of our email accounts
	// evaluation that we will use for generating our reports.
	MailboxCheckResults mbxs.MailboxCheckResults

	// MessagesFoundSummary is a one-line summary of the mail items found in
	// checked mailboxes.
	MessagesFoundSummary string

	// ReportTime is when the email summary report was generated.
	ReportTime time.Time

	// String used in place of incompatible Unicode characters for the utf8mb3
	// character set.
	UnicodeCharSubstitute string
}

ReportData represents the values that are used when generating reports via templates.

Jump to

Keyboard shortcuts

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