ctxconn

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ctxconn provides a helper function to track context cancellation when working with connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnOnDone

func CloseConnOnDone(ctx context.Context, conn DeadlineCloser) func() error

CloseConnOnDone closes conn whenever ctx is Done. This includes if ctx is canceled via its cancellation function.

Call the returned cancellation function to free up resources and closing the connection. The cancellation function returns any error from closing the connection.

Types

type DeadlineCloser

type DeadlineCloser interface {
	SetDeadline(t time.Time) error
	io.Closer
}

Directories

Path Synopsis
Package mock_ctxconn is a generated GoMock package.
Package mock_ctxconn is a generated GoMock package.

Jump to

Keyboard shortcuts

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