Documentation
¶
Index ¶
- type Feed
- type Formatter
- type InMemRepository
- func (f *InMemRepository) AddFeed(feed *Feed) error
- func (m *InMemRepository) AddSub(s *Subscription) error
- func (f *InMemRepository) AllFeeds() ([]*Feed, error)
- func (f *InMemRepository) FeedByName(name string) (*Feed, error)
- func (m *InMemRepository) SubByFeedId(id uint64) ([]*Subscription, error)
- func (m *InMemRepository) UpdateSub(s *Subscription) error
- type Item
- type Notification
- type NulledParser
- type ParsedFeed
- type Parser
- type Processor
- type Repository
- type Subscription
- type Subscriptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Formatter ¶
type Formatter interface {
Format(Notification) string
}
type InMemRepository ¶
type InMemRepository struct {
// contains filtered or unexported fields
}
func NewInMemRepo ¶
func NewInMemRepo() *InMemRepository
func (*InMemRepository) AddFeed ¶
func (f *InMemRepository) AddFeed(feed *Feed) error
func (*InMemRepository) AddSub ¶
func (m *InMemRepository) AddSub(s *Subscription) error
func (*InMemRepository) AllFeeds ¶
func (f *InMemRepository) AllFeeds() ([]*Feed, error)
func (*InMemRepository) FeedByName ¶
func (f *InMemRepository) FeedByName(name string) (*Feed, error)
func (*InMemRepository) SubByFeedId ¶
func (m *InMemRepository) SubByFeedId(id uint64) ([]*Subscription, error)
func (*InMemRepository) UpdateSub ¶
func (m *InMemRepository) UpdateSub(s *Subscription) error
type Item ¶
type Item struct {
Title string
Description string
Content string
Link string
Links []string
GUID string
Custom map[string]string
}
func (*Item) HasKeywords ¶
type Notification ¶
func (Notification) String ¶
func (n Notification) String() string
type NulledParser ¶
type NulledParser struct {
Parsed *ParsedFeed
}
func (*NulledParser) ParseURL ¶
func (p *NulledParser) ParseURL(url string) (*ParsedFeed, error)
type ParsedFeed ¶
type ParsedFeed struct {
Title string
Description string
Link string
Updated string
Published string
Items []*Item
Custom map[string]string
}
func (*ParsedFeed) HasKeywords ¶
func (feed *ParsedFeed) HasKeywords(keywords []string) bool
func (*ParsedFeed) ItemsWithKeywords ¶
func (feed *ParsedFeed) ItemsWithKeywords(keywords []string) []*Item
type Parser ¶
type Parser interface {
ParseURL(string) (*ParsedFeed, error)
}
Parser downloads a Feed.Url and translates it to a ParsedFeed to be checked by a Subscription.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func NewProcessor(repo Repository, parser Parser) *Processor
func (*Processor) Handle ¶
func (p *Processor) Handle() ([]*Notification, error)
type Repository ¶
type Repository interface {
AllFeeds() ([]*Feed, error)
AddFeed(*Feed) error
FeedByName(name string) (*Feed, error)
AddSub(*Subscription) error
UpdateSub(*Subscription) error
SubByFeedId(id uint64) ([]*Subscription, error)
}
type Subscription ¶
type Subscription struct {
Id uint64
FeedId uint64
User string
Keywords string
Channel string
Feed *Feed
Seen string // Item.GUID comma separated
SeenItems map[string]bool // [guid]bool
}
func (*Subscription) HasSeen ¶
func (s *Subscription) HasSeen(item Item) bool
func (*Subscription) KeywordsSlice ¶
func (sub *Subscription) KeywordsSlice() []string
func (*Subscription) See ¶
func (s *Subscription) See(item Item)
type Subscriptions ¶
type Subscriptions interface {
Add(*Subscription) error
Update(*Subscription) error
ByFeedId(id uint64) ([]*Subscription, error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.