index

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRegexpPattern

func GetRegexpPattern(pat string, ignoreCase bool) string

Types

type ExcludedFile

type ExcludedFile struct {
	Filename string
	Reason   string
}

type FileMatch

type FileMatch struct {
	Filename string
	Matches  []*Match
}

type Index

type Index struct {
	Ref *IndexRef
	// contains filtered or unexported fields
}

func Open

func Open(dir string) (*Index, error)

Open the index in dir for searching.

func (*Index) Close

func (n *Index) Close() error

func (*Index) Destroy

func (n *Index) Destroy() error

func (*Index) GetDir

func (n *Index) GetDir() string

func (*Index) Search

func (n *Index) Search(pat string, opt *SearchOptions) (*SearchResponse, error)

type IndexOptions

type IndexOptions struct {
	ExcludeDotFiles bool
	SpecialFiles    []string
}

type IndexRef

type IndexRef struct {
	Url  string
	Rev  string
	Time time.Time
	// contains filtered or unexported fields
}

func Build

func Build(opt *IndexOptions, dst, src, url, rev string) (*IndexRef, error)

func Read

func Read(dir string) (*IndexRef, error)

Read the metadata for the index directory. Note that even if this returns a non-nil error, a Metadata object will be returned with all the information that is known about the index (this might include only the path)

func (*IndexRef) Dir

func (r *IndexRef) Dir() string

func (*IndexRef) Open

func (r *IndexRef) Open() (*Index, error)

func (*IndexRef) Remove

func (r *IndexRef) Remove() error

type Match

type Match struct {
	Line       string
	LineNumber int
	Before     []string
	After      []string
}

type SearchOptions

type SearchOptions struct {
	IgnoreCase     bool
	LinesOfContext uint
	FileRegexp     string
	Offset         int
	Limit          int
}

type SearchResponse

type SearchResponse struct {
	Matches        []*FileMatch
	FilesWithMatch int
	FilesOpened    int           `json:"-"`
	Duration       time.Duration `json:"-"`
	Revision       string
}

Jump to

Keyboard shortcuts

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