Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

bgreader

v5.13.0
github.com/jackc/pgx/v5/pgconn/internal/bgreader

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

11 matches

Top ↑

Package bgreader provides a io.Reader that can optionally buffer reads in the background.

Constants

StatusStopped (3 declarations)

const (
	StatusStopped = iota
	StatusRunning
	StatusStopping
)

Types

BGReader

type BGReader struct {
	// contains filtered or unexported fields
}

BGReader is an io.Reader that can optionally buffer reads in the background. It is safe for concurrent use.

New

func New(r io.Reader) *BGReader

BGReader.Read

func (r *BGReader) Read(p []byte) (int, error)

Read implements the io.Reader interface.

BGReader.Start

func (r *BGReader) Start()

Start starts the backgrounder reader. If the background reader is already running this is a no-op. The background reader will stop automatically when the underlying reader returns an error.

BGReader.Status

func (r *BGReader) Status() int32

Status returns the current status of the background reader.

BGReader.Stop

func (r *BGReader) Stop()

Stop tells the background reader to stop after the in progress Read returns. It is safe to call Stop when the background reader is not running.

Dependency graph