writers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CsvWriter

type CsvWriter struct {
	FilePath string
	// contains filtered or unexported fields
}

CsvWriter writes CSV files

func NewCsvWriter

func NewCsvWriter(destination string) (*CsvWriter, error)

NewCsvWriter gets a new CsvWriter

func (*CsvWriter) Write

func (cw *CsvWriter) Write(result *models.Result) error

Write a CSV line

type DbWriter

type DbWriter struct {
	URI string
	// contains filtered or unexported fields
}

DbWriter is a Database writer

func NewDbWriter

func NewDbWriter(uri string, debug bool) (*DbWriter, error)

NewDbWriter initialises a database writer

func (*DbWriter) Write

func (dw *DbWriter) Write(result *models.Result) error

Write results to the database

type JsonWriter

type JsonWriter struct {
	FilePath string
}

JsonWriter is a JSON lines writer

func NewJsonWriter

func NewJsonWriter(destination string) (*JsonWriter, error)

NewJsonWriter return a new Json lines writer

func (*JsonWriter) Write

func (jw *JsonWriter) Write(result *models.Result) error

Write JSON lines to a file

type MemoryWriter

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

MemoryWriter is a memory-based results queue with a maximum slot count

func NewMemoryWriter

func NewMemoryWriter(slots int) (*MemoryWriter, error)

NewMemoryWriter initializes a MemoryWriter with the specified number of slots

func (*MemoryWriter) GetAllResults

func (s *MemoryWriter) GetAllResults() []*models.Result

GetAllResults returns a copy of all current results.

func (*MemoryWriter) GetFirst

func (s *MemoryWriter) GetFirst() *models.Result

GetFirst retrieves the oldest result in the MemoryWriter.

func (*MemoryWriter) GetLatest

func (s *MemoryWriter) GetLatest() *models.Result

GetLatest retrieves the most recently added result.

func (*MemoryWriter) Write

func (s *MemoryWriter) Write(result *models.Result) error

Write adds a new result to the MemoryWriter.

type NoneWriter

type NoneWriter struct {
}

NoneWriter is a None writer

func NewNoneWriter

func NewNoneWriter() (*NoneWriter, error)

NewNoneWriter initialises a none writer

func (*NoneWriter) Write

func (s *NoneWriter) Write(result *models.Result) error

Write does nothing

type StdoutWriter

type StdoutWriter struct {
}

StdoutWriter is a Stdout writer

func NewStdoutWriter

func NewStdoutWriter() (*StdoutWriter, error)

NewStdoutWriter initialises a stdout writer

func (*StdoutWriter) Write

func (s *StdoutWriter) Write(result *models.Result) error

Write results to stdout

type Writer

type Writer interface {
	Write(*models.Result) error
}

Writer is a results writer

Jump to

Keyboard shortcuts

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