scanfile

package module
v0.0.0-...-731abdc Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

README

go-scanfile

A file scan in go, just for fun.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufSize = 1024 * 1024 // buf大小
View Source
var LineFeed = byte('\n') //文本换行符标识
View Source
var MaxResult = 10

Functions

func InitMemFileContent

func InitMemFileContent(fileName string) *fileContent

func IoFileRead

func IoFileRead(fileName string) chan *string

文件IO操作,字符流放入channel

func MemScan

func MemScan(mf *MemFiles, searchStr *string) string

func MemScanFile

func MemScanFile(fc *fileContent, searchStr *string, counter *Counter, out chan *FileRes)

扫描文件

func PathFiles

func PathFiles(path string) []string

func Scan

func Scan(files []string, searchStr *string) string

func ScanFile

func ScanFile(fileName string, searchStr *string, counter *Counter, out chan *FileRes)

扫描文件

Types

type Counter

type Counter struct {
	Num int
	// contains filtered or unexported fields
}

func InitCounter

func InitCounter(max int) *Counter

func (*Counter) Add

func (st *Counter) Add()

func (*Counter) IsMax

func (st *Counter) IsMax() bool

func (*Counter) SetMax

func (st *Counter) SetMax(max int)

type FileRes

type FileRes struct {
	File    string
	Strings StringArray
	Num     int
}

单个文件扫描后返回对象

func InitFileRes

func InitFileRes(file string) *FileRes

func (*FileRes) Add

func (res *FileRes) Add(str string)

type MemFiles

type MemFiles struct {
	MFile map[string]*fileContent
}

func InitMemFiles

func InitMemFiles(files []string) *MemFiles

type ScanResult

type ScanResult struct {
	ResList []*FileRes
	Counter *Counter
}

ScanFile 扫描后返回对象

func (*ScanResult) AddCounter

func (result *ScanResult) AddCounter(counter *Counter)

func (*ScanResult) AddFileRes

func (result *ScanResult) AddFileRes(res *FileRes)

func (*ScanResult) ToJson

func (result *ScanResult) ToJson() string

type StringArray

type StringArray []string

func (*StringArray) Set

func (a *StringArray) Set(s string)

func (*StringArray) String

func (a *StringArray) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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