reader

package
v0.0.0-...-b36bff9 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExactFinder

type ExactFinder struct {
	Search string
	// contains filtered or unexported fields
}

ExactFinder : a exact Finder for searching, Case sensitive。

func (*ExactFinder) Find

func (e *ExactFinder) Find(input string) (string, bool)

type Finder

type Finder interface {
	Find(input string) (string, bool)
}

Finder is a interface for searching. it can find text string based on a plain text or regexp. if cannot found it returns an empty string.

func NewFinder

func NewFinder(search string, regexp, sensitive bool) (Finder, error)

type IExactFinder

type IExactFinder struct {
	Search string
	// contains filtered or unexported fields
}

IExactFinder : a exact Finder for searching,not Case-sensitive。

func (*IExactFinder) Find

func (i *IExactFinder) Find(input string) (string, bool)

type MatchRes

type MatchRes struct {
	Filename    string
	Lines       []int64
	MatchString []string
}

a return value

type MultiReader

type MultiReader struct {
	Output []MatchRes
	Error  error
	// contains filtered or unexported fields
}

func (*MultiReader) Close

func (m *MultiReader) Close()

func (*MultiReader) IsError

func (m *MultiReader) IsError() error

func (*MultiReader) Result

func (m *MultiReader) Result() []MatchRes

func (*MultiReader) Run

func (m *MultiReader) Run()

type Reader

type Reader interface {
	//a fun to start
	Run()

	// a func to close the reader
	Close()

	Result() []MatchRes

	IsError() error
}

func NewMultiReader

func NewMultiReader(path []string, finder []Finder, isRecursive bool) (Reader, error)

func NewStdReader

func NewStdReader(reader io.Reader, finder []Finder) (Reader, error)

type RegexpFinder

type RegexpFinder struct {
	*regexp.Regexp
	// contains filtered or unexported fields
}

RegexpFinder : a regexp finder for searching string.

func (RegexpFinder) Find

func (r RegexpFinder) Find(input string) (string, bool)

type StdReader

type StdReader struct {
	Output []MatchRes
	Error  error
	// contains filtered or unexported fields
}

func (*StdReader) Close

func (s *StdReader) Close()

func (*StdReader) IsError

func (s *StdReader) IsError() error

func (*StdReader) Result

func (s *StdReader) Result() []MatchRes

func (*StdReader) Run

func (s *StdReader) Run()

Jump to

Keyboard shortcuts

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