writer

package
v0.0.0-...-6fb0361 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString generates a random alphanumerical string with a requested length

Types

type WriteRequest

type WriteRequest struct {
	Line string
}

WriteRequest contains type that the writer uses

type Writer

type Writer struct {
	File        *os.File
	Directory   string
	Flag        int
	Permissions os.FileMode
	WriteQueue  chan string
	DoneChan    chan bool
	Logger      *log.Logger
}

Writer describes a writer

func NewWriter

func NewWriter(w Writer) Writer

NewWriter creates and returns a new Writer object

func (*Writer) Close

func (w *Writer) Close() error

Close closes the file descriptor of the current file

func (*Writer) Open

func (w *Writer) Open(dir string) error

Open creates a new file with unique name in the dir path for writing the output

func (*Writer) Start

func (w *Writer) Start() error

Start starts a writer

func (*Writer) Stop

func (w *Writer) Stop()

Stop closes the write queue of the writer which triggers a graceful stop

func (*Writer) Write

func (w *Writer) Write(line string) error

Write writes input strings to the last open file When the last open file does not exist, a new one is created

Jump to

Keyboard shortcuts

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