Documentation
¶
Index ¶
Constants ¶
const ( URL LinkType = "URL" Email = "Email" InternalLink = "InternalLink" )
const - Enum to determine the type of link
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileProcessor ¶ added in v1.1.0
type FileProcessor interface {
ProcessFile()
}
FileProcessor - process a single file, get links and check them
func GetNewFileProcessor ¶ added in v1.1.0
func GetNewFileProcessor(filePath string, resultChan chan *LinkResult) FileProcessor
GetNewFileProcessor - get instance of file processor
type FileResultData ¶ added in v1.1.0
type FileResultData struct {
FilePath string
Error bool
Links []*LinkResult
}
FileResultData - contains all file links and their data
type FilesProcessor ¶
FilesProcessor - process multiple files either parallel or one by one
func GetFilesProcessorInstance ¶
func GetFilesProcessorInstance() FilesProcessor
GetFilesProcessorInstance - get instance of files processor (Singleton)
type LinkHandlerInterface ¶ added in v1.1.0
LinkHandlerInterface - interface to define different link handlers
func GetEmailHandlerInstance ¶
func GetEmailHandlerInstance() LinkHandlerInterface
GetEmailHandlerInstance Get email handler instance
func GetInternalLinkHandler ¶ added in v1.1.0
func GetInternalLinkHandler(filePath string) LinkHandlerInterface
GetInternalLinkHandler - handles internal links
func GetURLHandlerInstance ¶
func GetURLHandlerInstance() LinkHandlerInterface
GetURLHandlerInstance - get instance of URL handler, handle links with http in them (singleton)
type LinkProcessor ¶ added in v1.1.0
type LinkProcessor interface {
CheckLink(filePath string, linkPath string, lineNumber int) *LinkResult
ExtractLinks(fileData string) []*linkPath
}
LinkProcessor - process a single link, sends it to handler according to its type
func GetLinkProcessorInstance ¶ added in v1.1.0
func GetLinkProcessorInstance() LinkProcessor
GetLinkProcessorInstance - get instance of link processor
type LinkResult ¶
type LinkResult struct {
// contains filtered or unexported fields
}
LinkResult - a descriptor which contains data for a single link
type Result ¶
type Result struct {
FilesLinksMap map[string]*FileResultData
Channel chan *LinkResult
// contains filtered or unexported fields
}
Result - a result for an entire run use channel to get results
func (*Result) AddNewFile ¶
func (res *Result) AddNewFile(fileLink *FileResultData)
AddNewFile - add new file to the FileLinksMap to be saved as part of the results