filesystem

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilenameFunc

type FilenameFunc func() string

FilenameFunc provide a wrapper to implement a Filenamer with just a func()string

func (FilenameFunc) Filename

func (f FilenameFunc) Filename([]byte) string

type Filenamer

type Filenamer interface {
	Filename(msg []byte) string
}

Filenamer is used to provide an easy way to generate dynamic files name to reader/writer msg is readed from input chanel in Process

type Reader

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

Reader for every message received it call Filenamer.Filename(msg) to get a filename to open a given file, then read it until eof or context is cancelled

func NewReader

func NewReader(opts ReaderOptions) *Reader

func (*Reader) Process

func (r *Reader) Process(ctx context.Context, args selina.ProcessArgs) (err error)

type ReaderOptions

type ReaderOptions struct {
	Fs        afero.Fs
	SplitFunc bufio.SplitFunc
	Filename  Filenamer
	Hanlder   selina.ErrorHandler
}

type Writer

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

func NewWriter

func NewWriter(opts WriterOptions) *Writer

func (Writer) Process

func (w Writer) Process(ctx context.Context, args selina.ProcessArgs) (err error)

type WriterOptions

type WriterOptions struct {
	Filename   Filenamer
	Fs         afero.Fs
	AddNewLine bool
	BufferSize int
	Mode       os.FileMode
	Hanlder    selina.ErrorHandler
}

Jump to

Keyboard shortcuts

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