Documentation
¶
Overview ¶
Package checkfile provides functions to check file status and content.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAll ¶
func ContainsAll(path string, termsBuffer *TermsBuffer) (bool, error)
ContainsAll returns true, if the file exists and contains all of the search terms.
func ContainsAny ¶
func ContainsAny(path string, termsBuffer *TermsBuffer) (bool, error)
ContainsAny returns true, if the file exists and contains at least one of the search terms.
func Exists ¶
Exists returns true, if the file exists. It doesn't matter if it's a directory or a file.
func IsDirectory ¶
IsDirectory returns true, if the file exists and is a directory.
Types ¶
type TermsBuffer ¶
type TermsBuffer struct {
Buffer []byte
Terms [][]byte
MinLength int
MaxLength int
Unmatched []int
}
TermsBuffer holds a buffer for the file and the search terms.
func NewTermsBuffer ¶
func NewTermsBuffer(bufferSize int, searchTerms []string) *TermsBuffer
NewTermsBuffer creates a new instance of TermsBuffer.
func NewTermsBufferFromBytes ¶
func NewTermsBufferFromBytes(bufferSize int, searchTerms [][]byte) *TermsBuffer
NewTermsBufferFromBytes creates a new instance of TermsBuffer.
func (*TermsBuffer) SetTerms ¶
func (termsBuffer *TermsBuffer) SetTerms(searchTerms []string)
SetTerms sets the search terms and the minimum and maximum term length. Empty search terms are removed.
func (*TermsBuffer) SetTermsFromBytes ¶
func (termsBuffer *TermsBuffer) SetTermsFromBytes(searchTerms [][]byte)
SetTermsFromBytes sets the search terms and the minimum and maximum term length. Empty search terms are not removed.