Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNopWriteCloser ¶ added in v0.1.3
func NewNopWriteCloser(w io.Writer) io.WriteCloser
Types ¶
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
LineWriter ensures that only whole lines are sent to encapsulated io.Writer. It is useful to simplify writers that work with whole lines, like log lines or textual data processing.
func NewLineWriter ¶
func NewLineWriter(w io.Writer) *LineWriter
NewLineWriter wraps io.Writer and sends to its Write method only full lines. To flush the possible remaining bytes in buffer, make sure to call the Close method as soon as the writing is done.
func (*LineWriter) Close ¶
func (w *LineWriter) Close() error
Close flushes the buffer and closes the encapsulated writer if it satisfies io.Closer interface.
func (*LineWriter) Flush ¶ added in v0.1.2
func (w *LineWriter) Flush() error
Flush writes any remaining data as a single line.
type NopWriteCloser ¶ added in v0.1.3
func (NopWriteCloser) Close ¶ added in v0.1.3
func (NopWriteCloser) Close() error
type PrefixWriter ¶
type PrefixWriter struct {
// contains filtered or unexported fields
}
PrefixWriter appends a fixed prefix to each line that is written to encapsulated io.Writer.
func NewPrefixWriter ¶
func NewPrefixWriter(prefix string, w io.Writer) *PrefixWriter
NewPrefixWriter creates a new PrefixWriter.
type ReplaceableWriter ¶ added in v0.1.3
type ReplaceableWriter[F comparable] struct { // contains filtered or unexported fields }
func NewReplaceableWriter ¶ added in v0.1.3
func NewReplaceableWriter[F comparable](constructor func(flag F) (io.Writer, F, error)) *ReplaceableWriter[F]
func (*ReplaceableWriter[F]) Close ¶ added in v0.1.3
func (w *ReplaceableWriter[F]) Close() error