output

package
v0.5.37 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STDOUT_WRITER_TYPE = "stdout"
	FILE_WRITER_TYPE   = "file"
	API_WRITER_TYPE    = "api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIWriter added in v0.1.3

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

The APIWriter is meant to write to a custom API and assumes many things. So currently, it is better not to use this APIWriter.

func NewAPIWriter added in v0.1.3

func NewAPIWriter(wc *WriterConfig) *APIWriter

NewAPIWriter returns a new APIWriter

func (*APIWriter) Write added in v0.1.3

func (f *APIWriter) Write(items chan map[string]interface{})

type FileWriter added in v0.1.9

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

func NewFileWriter added in v0.1.9

func NewFileWriter(wc *WriterConfig) *FileWriter

NewFileWriter returns a new FileWriter

func (*FileWriter) Write added in v0.1.9

func (fr *FileWriter) Write(items chan map[string]interface{})

type StdoutWriter added in v0.1.3

type StdoutWriter struct{}

func (*StdoutWriter) Write added in v0.1.3

func (s *StdoutWriter) Write(items chan map[string]interface{})

type Writer added in v0.1.3

type Writer interface {
	// if a writer encounters a fatal error it should call log.Fatalf
	// to prevent the crawler from uselessly continuing to run.
	Write(itemsList chan map[string]interface{})
}

type WriterConfig added in v0.2.1

type WriterConfig struct {
	Type     string `yaml:"type" env:"WRITER_TYPE"`
	Uri      string `yaml:"uri" env:"WRITER_URI"`
	User     string `yaml:"user" env:"WRITER_USER"`
	Password string `yaml:"password" env:"WRITER_PASSWORD"`
	FilePath string `yaml:"filepath" env:"WRITER_FILEPATH"`
}

.WriterConfig defines the necessary paramters to make a new writer which is responsible for writing the scraped data to a specific output eg. stdout.

Jump to

Keyboard shortcuts

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