lines

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxMsgSize = 1024 * 128 // 128 KiB

MaxMsgSize establishes the threshold to flush the buffer when using the `Send` function. It's a variable instead of a constant to make it easier to override in tests.

Functions

func CopyAndAppend

func CopyAndAppend(s [][]byte, e []byte) ([][]byte, int)

CopyAndAppend adds a newly allocated copy of `e` to the `s` slice. Useful to avoid io buffer shennanigans

func ScanWithDelimiter added in v0.18.0

func ScanWithDelimiter(delim []byte) bufio.SplitFunc

ScanWithDelimiter generates a `bufio.SplitFunc` that uses `delim` as the delimiter. Based on `bufio.ScanLines` https://golang.org/src/bufio/scan.go?s=11488:11566#L329

func Send

func Send(r io.Reader, sender Sender, split bufio.SplitFunc) error

Send reads from `r` and handles the buffered lines using `sender`, optionally using the SplitFunc `split` for the Scanner

Types

type Sender

type Sender func([][]byte) error

Sender handles a buffer of lines from a Git command

Jump to

Keyboard shortcuts

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