report

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Now = time.Now

Now returns the current time

Functions

func PrettyJSON

func PrettyJSON(jsonBytes []byte) ([]byte, error)

PrettyJSON will indent JSON to be pretty

func WriteReports

func WriteReports(format string, output io.Writer, reports reports, outputTemplate string) error

WriteReports writes the result to output, format as passed in argument

Types

type JSONWriter

type JSONWriter struct {
	Output io.Writer
}

JSONWriter implements result Writer

func (JSONWriter) Write

func (jw JSONWriter) Write(reports reports) error

Write writes the reports in JSON format

type TemplateWriter

type TemplateWriter struct {
	Output   io.Writer
	Template *template.Template
}

TemplateWriter write result in custom format defined by user's template

func NewTemplateWriter

func NewTemplateWriter(output io.Writer, outputTemplate string) (*TemplateWriter, error)

NewTemplateWriter is the factory method to return TemplateWriter object

func (TemplateWriter) Write

func (tw TemplateWriter) Write(reports reports) error

Write writes result

type Writer

type Writer interface {
	Write(reports) error
}

Writer defines the result write operation

Jump to

Keyboard shortcuts

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