processor

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedCSVWriter

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

BufferedCSVWriter implements DataProcessor interface

func NewBufferedCSVWriter

func NewBufferedCSVWriter(filename string, bufferSize int, flushInterval time.Duration) (*BufferedCSVWriter, error)

NewBufferedCSVWriter creates a new BufferedCSVWriter

func (*BufferedCSVWriter) Close

func (w *BufferedCSVWriter) Close() error

Close flushes any remaining data and closes the CSV file

func (*BufferedCSVWriter) GetBufferSize

func (w *BufferedCSVWriter) GetBufferSize() int

GetBufferSize returns the current size of the buffer

func (*BufferedCSVWriter) GetProcessedCount

func (w *BufferedCSVWriter) GetProcessedCount() int

GetProcessedCount returns the number of processed messages

func (*BufferedCSVWriter) Process

func (w *BufferedCSVWriter) Process(data models.FormattedData)

Process implements the DataProcessor interface

type DataProcessor

type DataProcessor interface {
	Process(data models.FormattedData)
	GetProcessedCount() int
	GetBufferSize() int
}

DataProcessor interface for the Observer pattern

type PGWriter added in v1.1.1

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

PGWriter implements DataProcessor interface for PostgreSQL

func NewPGWriter added in v1.1.1

func NewPGWriter(db *sql.DB) (*PGWriter, error)

NewPGWriter creates a new PGWriter

func (*PGWriter) Close added in v1.1.1

func (w *PGWriter) Close() error

Close closes the PostgreSQL connection

func (*PGWriter) GetBufferSize added in v1.1.1

func (w *PGWriter) GetBufferSize() int

GetBufferSize returns the current size of the buffer (always 0 for immediate insert)

func (*PGWriter) GetProcessedCount added in v1.1.1

func (w *PGWriter) GetProcessedCount() int

GetProcessedCount returns the number of processed messages

func (*PGWriter) Process added in v1.1.1

func (w *PGWriter) Process(data models.FormattedData)

Process implements the DataProcessor interface

Jump to

Keyboard shortcuts

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