Documentation
¶
Index ¶
- Constants
- type Indexer
- func (i *Indexer) CreateCategoryFolders() (err error)
- func (i *Indexer) CreateIndexForCategory(category string, files models.SortedFiles) (err error)
- func (i *Indexer) CreateIndexForNewsCategory(files models.SortedFiles) (err error)
- func (i *Indexer) GetAllSortedFiles() (sortedFiles models.SortedFiles, err error)
- func (i *Indexer) GetArticleDateTime(filePath string) (dateTime time.Time, err error)
- func (i *Indexer) GetDateTimeFromFolder(folderPath string) (unsortedFiles models.SortedFiles, err error)
- func (i *Indexer) GetLongNewsBlock(fileRelPath string) (block string, err error)
- func (i *Indexer) GetShortNewsBlock(fileRelPath string) (block string, err error)
- func (i *Indexer) GetSortedFilesForCategory(category string) (sortedFiles models.SortedFiles, err error)
Constants ¶
const ( // CategoryNews is the name of the news category[*]. CategoryNews = "news" NewsBlockDateFormat = "02.01.2006" EmptyCategoryContent = "There are no articles in this category at the moment." )
const ( ErrCategoryIsNotFound = "category is not found: %v" ErrNewsCategoryIsASpecialCategory = "news category is a special category" ErrArticleIsDamaged = "article is damaged: %v" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Indexer ¶
type Indexer struct { CLA *cla.CommandLineArguments Settings *settings.Settings }
func NewIndexer ¶
func (*Indexer) CreateCategoryFolders ¶
CreateCategoryFolders creates category[*] folders if necessary.
func (*Indexer) CreateIndexForCategory ¶
func (i *Indexer) CreateIndexForCategory(category string, files models.SortedFiles) (err error)
CreateIndexForCategory creates an index file for a single category[*].
func (*Indexer) CreateIndexForNewsCategory ¶
func (i *Indexer) CreateIndexForNewsCategory(files models.SortedFiles) (err error)
CreateIndexForNewsCategory creates an index file for the news category[*].
func (*Indexer) GetAllSortedFiles ¶
func (i *Indexer) GetAllSortedFiles() (sortedFiles models.SortedFiles, err error)
GetAllSortedFiles gets all the files from all the categories[*] and sorts them.
func (*Indexer) GetArticleDateTime ¶
GetArticleDateTime extracts the DateTime from an article's file.
func (*Indexer) GetDateTimeFromFolder ¶
func (i *Indexer) GetDateTimeFromFolder(folderPath string) (unsortedFiles models.SortedFiles, err error)
GetDateTimeFromFolder gets the DateTime from all the files in the specified folder, including its sub-folders. A returned array's items have two fields: date-time and a file path relative to the JSON data folder.
func (*Indexer) GetLongNewsBlock ¶
GetLongNewsBlock gets the text of a long news block from an article. Long news block consists of icon, title and description. fileRelPath is a path relative to the JSON data folder.
func (*Indexer) GetShortNewsBlock ¶
GetShortNewsBlock gets the text of a short news block from an article. Short news block consists of date and title. fileRelPath is a path relative to the JSON data folder.
func (*Indexer) GetSortedFilesForCategory ¶
func (i *Indexer) GetSortedFilesForCategory(category string) (sortedFiles models.SortedFiles, err error)
GetSortedFilesForCategory gets all files from a single category[*] and sorts them. The 'category' parameter is the category's path.