closer

package
v1.3.2-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseWithLogOnError

func CloseWithLogOnError(name string, c io.Closer)

CloseWithLogOnError will close the given resource and log any relevant failure

func ContextCloserWithLogOnError added in v0.3.24

func ContextCloserWithLogOnError(ctx context.Context, name string, c CloseWithContext)

ContextCloserWithLogOnError will close the given resource using the context and log any relevant failure

func DrainAndCloseWithLogOnError

func DrainAndCloseWithLogOnError(ctx context.Context, name string, c io.ReadCloser)

DrainAndCloseWithLogOnError will first ensure the contents of the reader has been read before being closed. This is useful when dealing with HTTP response bodies which need to be drained and closed so that the connection may be reused by the OS.

Types

type CloseWithContext added in v0.3.24

type CloseWithContext interface {
	Close(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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