onclose

package
v0.0.0-...-189a019 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloseCallback

type CloseCallback func()

An CloseCallback is a callback type called when a Writer is closed

type Writer

type Writer struct {
	Writer      io.Writer
	BeforeClose CloseCallback
	AfterClose  CloseCallback
}

Writer implements io.WriteCloser and has callbacks for before and after the underlying writer is closed

func (*Writer) Close

func (w *Writer) Close() error

Close first calls OnClose, then closes the underlying writer (if the callback didn't return an error)

func (*Writer) Write

func (w *Writer) Write(buf []byte) (int, error)

Write relays the write directly to the underlying writer

Jump to

Keyboard shortcuts

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