liner

package module
v0.0.0-...-0572b62 Latest Latest
Warning

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

Go to latest
Published: May 12, 2018 License: MIT Imports: 5 Imported by: 0

README

liner

line processing utility for golang

go get -u github.com/0x75960

usage

import (

	// ...

	"github.com/0x75960/liner"
)

func main() {

	f, err := os.Open("/path/to/files")
	if err != nil {
		log.Fatalln(err)
	}

	defer f.Close()

	for line := range liner.LinesIn(f) {
		fmt.Println(line)
	}

	proc(f)

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinesIn

func LinesIn(r io.Reader) (o chan string)

LinesIn from io.Reader

func LinesInProcessing

func LinesInProcessing(cmd *exec.Cmd) (o chan string, err error)

LinesInProcessing Command

func NewConcurrentLineProcessor

func NewConcurrentLineProcessor(handler func(string) error, concurrency uint, strategy ErrStrategy) func(io.Reader)

NewConcurrentLineProcessor from handler and strategy

func NewLineProcessor

func NewLineProcessor(handler func(string) error, strategy ErrStrategy) func(io.Reader)

NewLineProcessor from handler and strategy

Types

type ErrStrategy

type ErrStrategy int

ErrStrategy when encounting error

const (
	// IgnoreWhenError (no logging and continue)
	IgnoreWhenError ErrStrategy = iota

	// LogWhenError (continue)
	LogWhenError

	// StopWhenError (not continue)
	StopWhenError
)

Jump to

Keyboard shortcuts

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