readers

package module
v0.0.0-...-97bc4b4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 6 Imported by: 0

README

readers

"readers" implements a common interface to "read" tokens/lines from different inputs (command line arguments, file, SQS query or AWS buckets or queues)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgReader

func ArgReader(args []string) chan string

ArgReader returns a "list" of the input arguments

func LineReader

func LineReader(r io.Reader) chan string

LineReader returns a "list" of lines read from the file. note that it skips empty lines

func SQLReader

func SQLReader(db *sql.DB, query string) chan string

SQLReader returns a "list" of results from the specified queury

func SetLogLevel

func SetLogLevel(level log.LogLevel)

SetLogLevel set the logging level for readers

Types

type ArgScanner

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

ArgScanner scan a list of arguments

func (*ArgScanner) Err

func (s *ArgScanner) Err() error

func (*ArgScanner) Scan

func (s *ArgScanner) Scan() bool

func (*ArgScanner) Text

func (s *ArgScanner) Text() string

type InputReader

type InputReader chan string

An InputReader is a "list" of lines (backed by a channel)

type InputScanner

type InputScanner interface {
	Scan() bool
	Text() string
	Err() error
}

An InputScanner returns a list of lines

func ScanArgs

func ScanArgs(args []string) InputScanner

ScanArgs returns an ArgScanner

func ScanReader

func ScanReader(r io.Reader) InputScanner

ScanReader returns an ReaderScanner

func ScanSQL

func ScanSQL(db *sql.DB, query string) InputScanner

SQLScanner returns an InputScanner running over the result of the specified SQL query

type ReaderScanner

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

func (*ReaderScanner) Err

func (s *ReaderScanner) Err() error

func (*ReaderScanner) Scan

func (s *ReaderScanner) Scan() bool

func (*ReaderScanner) Text

func (s *ReaderScanner) Text() string

type SQLScanner

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

func (*SQLScanner) Err

func (s *SQLScanner) Err() error

func (*SQLScanner) Scan

func (s *SQLScanner) Scan() bool

func (*SQLScanner) Text

func (s *SQLScanner) Text() string

Directories

Path Synopsis
Package aws implements InputReader(s) that access AWS services (S3 and SQS)
Package aws implements InputReader(s) that access AWS services (S3 and SQS)

Jump to

Keyboard shortcuts

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