iox

package
v0.0.0-...-9d95335 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(cc ...io.Closer)

Close closes the io.Closer and log print if error occurs.

func CloseAny

func CloseAny(cc ...interface{})

CloseAny closes any and log print if error occurs.

func DiscardClose

func DiscardClose(c io.ReadCloser)

DiscardClose discards the reader and then close it.

func ReadBytes

func ReadBytes(r io.Reader) []byte

func ReadString

func ReadString(r io.Reader) string

Types

type BufioWriteCloser

type BufioWriteCloser struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func NewBufioWriteCloser

func NewBufioWriteCloser(w io.WriteCloser) *BufioWriteCloser

func (*BufioWriteCloser) Close

func (b *BufioWriteCloser) Close() error

type MaxLatencyWriter

type MaxLatencyWriter struct {
	Dst     WriteFlusher
	Latency time.Duration // non-zero; negative means to flush immediately
	// contains filtered or unexported fields
}

func (*MaxLatencyWriter) Stop

func (m *MaxLatencyWriter) Stop()

func (*MaxLatencyWriter) Write

func (m *MaxLatencyWriter) Write(p []byte) (n int, err error)

type WriteFlusher

type WriteFlusher interface {
	io.Writer
	Flush() error
}

type WriteTempFileOption

type WriteTempFileOption struct {
	Content      []byte
	TempDir      string
	Pattern      string
	PanicOnError bool
}

type WriteTempFileOptionFn

type WriteTempFileOptionFn func(*WriteTempFileOption)

func PanicOnError

func PanicOnError(c bool) WriteTempFileOptionFn

func WithTempContent

func WithTempContent(c []byte) WriteTempFileOptionFn

func WithTempDir

func WithTempDir(c string) WriteTempFileOptionFn

func WithTempPattern

func WithTempPattern(c string) WriteTempFileOptionFn

func WithTempString

func WithTempString(c string) WriteTempFileOptionFn

type WriteTempFileResult

type WriteTempFileResult struct {
	Name string
	Err  error
}

func WriteTempFile

func WriteTempFile(fns ...WriteTempFileOptionFn) *WriteTempFileResult

WriteTempFile writes the content to a temporary file.

Jump to

Keyboard shortcuts

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