Documentation
¶
Index ¶
- Constants
- func GetArticleFromNewsElement(n NewsElement, teamId string, hasDetails bool) (types.Article, error)
- func PollNewsDetailsIntoStorage(ctx context.Context, config DetailsConfig, logger logr.Logger, ...)
- func PollNewsDetailsIntoStorageOfGivenID(ctx context.Context, config DetailsConfig, logger logr.Logger, ...) error
- func PollNewsListIntoStorage(ctx context.Context, config ListConfig, logger logr.Logger, ...)
- func StartPollerWithConfigFile(ctx context.Context, v *viper.Viper, logger logr.Logger, ...) error
- type Config
- type DetailsConfig
- type ListConfig
- type NewsDetailed
- type NewsElement
- type NewsList
Constants ¶
const NewsPublishedDateLayout = "2006-01-02 15:04:05"
NewsPublishedDateLayout is the layout for date time in gathered news remember that layout needs to be pointing to Jan 2, 2006 at 3:04pm (MST) in expected format
Variables ¶
This section is empty.
Functions ¶
func GetArticleFromNewsElement ¶
func GetArticleFromNewsElement(n NewsElement, teamId string, hasDetails bool) (types.Article, error)
GetArticleFromNewsElement creates Article from NewsElement taken as a value so that it can create pointers to its fields
func PollNewsDetailsIntoStorage ¶
func PollNewsDetailsIntoStorage(ctx context.Context, config DetailsConfig, logger logr.Logger, s storage.ArticleStorage)
func PollNewsDetailsIntoStorageOfGivenID ¶
func PollNewsDetailsIntoStorageOfGivenID(ctx context.Context, config DetailsConfig, logger logr.Logger, s storage.ArticleStorage, newsId string) error
func PollNewsListIntoStorage ¶
func PollNewsListIntoStorage(ctx context.Context, config ListConfig, logger logr.Logger, s storage.ArticleStorage)
Types ¶
type Config ¶
type Config struct { TeamId string `mapstructure:"teamId"` RunOnceAtBoot bool `mapstructure:"runOnceAtBoot"` List struct { URL string `mapstructure:"url"` Count int `mapstructure:"count"` Schedule string `mapstructure:"schedule"` } `mapstructure:"list"` Details struct { URL string `mapstructure:"url"` Schedule string `mapstructure:"schedule"` } `mapstructure:"details"` }
func (Config) GetDetailsSchedule ¶
func (Config) GetDetailsURL ¶
func (Config) GetListCount ¶
func (Config) GetListSchedule ¶
func (Config) GetListURL ¶
type DetailsConfig ¶
type ListConfig ¶
type NewsDetailed ¶
type NewsDetailed struct { XMLName xml.Name `xml:"NewsArticleInformation"` Text string `xml:",chardata"` ClubName string `xml:"ClubName"` // Hull City ClubWebsiteURL string `xml:"ClubWebsiteURL"` // https://www.wearehullcity... NewsArticle NewsElement `xml:"NewsArticle"` }
NewsDetailed is struct for getting detailed single news from feed.
It was generated with the help of:
go install github.com/miku/zek/cmd/zek@latest cat examples/hullcityDetailed.xml | zek -e
The inner news element was refactored into separate struct NewsElement.
type NewsElement ¶
type NewsElement struct { Text string `xml:",chardata"` ArticleURL string `xml:"ArticleURL"` // https://www.wearehullcity... NewsArticleID string `xml:"NewsArticleID"` // 444541, 444515, 444506, 4... PublishDate string `xml:"PublishDate"` // 2023-03-04 18:58:00, 2023... Taxonomies string `xml:"Taxonomies"` // Academy, Academy, Intervi... ThumbnailImageURL string `xml:"ThumbnailImageURL"` // https://www.wearehullcity... Title string `xml:"Title"` // Hall: ‘Really happy wit... OptaMatchId string `xml:"OptaMatchId"` // g2322054, g2322054, g2300... LastUpdateDate string `xml:"LastUpdateDate"` // 2023-03-05 02:00:11, 2023... IsPublished string `xml:"IsPublished"` // True, True, True, True, T... Subtitle string `xml:"Subtitle"` BodyText string `xml:"BodyText"` // <p class="x_MsoNormal">Be... GalleryImageURLs string `xml:"GalleryImageURLs"` VideoURL string `xml:"VideoURL"` }
NewsElement is inner element merged from NewsList inner element and NewsDetailed inner element.
type NewsList ¶
type NewsList struct { XMLName xml.Name `xml:"NewListInformation"` Text string `xml:",chardata"` ClubName string `xml:"ClubName"` // Hull City ClubWebsiteURL string `xml:"ClubWebsiteURL"` // https://www.wearehullcity... NewsletterNewsItems struct { Text string `xml:",chardata"` NewsletterNewsItem []NewsElement `xml:"NewsletterNewsItem"` } `xml:"NewsletterNewsItems"` }
NewsList is struct for getting news from feed.
It was generated with the help of:
go install github.com/miku/zek/cmd/zek@latest cat examples/hullcityList.xml | zek -e
The inner news element was refactored into separate struct NewsElement.