es_sort

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorAlreadyClosed = errors.New("the sorter resources already flushed and closed")
)

Functions

This section is empty.

Types

type Compare

type Compare func(x, y string) int

Compare returns an integer comparing two lines. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.

type Sorter

type Sorter interface {
	// WriteLine Write single line. The function will split into multiple lines if a line contains '\n'.
	WriteLine(line string) error

	// Close and flush the result into destination stream, then close all resources.
	Close() error
}

Sorter Sort large text data

func New

func New(destStream io.WriteCloser, opts ...SorterOpt) Sorter

type SorterOpt

type SorterOpt func(opts sorterOpts) sorterOpts

func Comparator

func Comparator(comparator Compare) SorterOpt

func Desc

func Desc(enabled bool) SorterOpt

func Logger

func Logger(logger esl.Logger) SorterOpt

func MemoryLimit

func MemoryLimit(limit int) SorterOpt

func TempCompress

func TempCompress(enabled bool) SorterOpt

func TempFolder

func TempFolder(path string) SorterOpt

TempFolder Specify temporary folder. It's caller's responsibility to remove the temp folder if specified.

func Uniq

func Uniq(enabled bool) SorterOpt

Jump to

Keyboard shortcuts

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