Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct { DocumentName string `json:"documentName"` Matches []*PatternMatch `json:"matches"` }
A Document represents an instance of a text document and a series of pattern matches for a specified search term.
func NewDocument ¶
NewDocument creates a new document with a document name and blank matches
func (*Document) HasMatchIndex ¶
HasMatchIndex returns true/false if this document has a match captured at this location/index in the text document
type DocumentIndex ¶
A DocumentIndex represents a matched pattern text in a single document. This is used during the document scanning process.
type FileIndexMatch ¶
A FileIndexMatch is used when scanning a file for text patterns
type PatternMatch ¶
type PatternMatch struct { Captures []string `json:"captures"` Location int `json:"location"` Match string `json:"match"` }
A PatternMatch is the information about a particlar match in a document. This includes the starting location/index of the match, the contents of the match, and all regex capture groups.
type PhysicalFile ¶
type PhysicalFile struct { Contents string `json:"contents"` FileName string `json:"fileName"` // contains filtered or unexported fields }
A PhysicalFile represents a file on a file system. This structure provides methods to read a file and perform an pattern match scan on it.
func NewPhysicalFile ¶
func NewPhysicalFile(fileName string, textPatterns []*config.TextPattern) *PhysicalFile
NewPhysicalFile creates a new PhysicalFile structure. It takes a file name and a set of regular expressions to run against it.
func (*PhysicalFile) CreateIndex ¶
func (file *PhysicalFile) CreateIndex() DocumentIndex
CreateIndex creates an index of matched patterns, each with a set of documents attached to them.
func (*PhysicalFile) Read ¶
func (file *PhysicalFile) Read() (string, error)
Read reads the actual contents of a file and puts them into the Contents key
func (*PhysicalFile) String ¶
func (file *PhysicalFile) String() string
String returns the file name
type Term ¶
Term is a structure that represents an instance of a matched pattern in one or more text documents. This is used as the value of tree nodes, and is what is returned to callers when searching for terms.
func (*Term) Compare ¶
Compare returns 0, 1, or -1 if the second instance of Term is the same as, greater than, or less than the first instance.