Documentation ¶
Index ¶
- Constants
- type DefaultFormatter
- type Feed
- type Formatter
- type InMemRepository
- func (r *InMemRepository) AddFeed(feed *Feed) error
- func (r *InMemRepository) AddSub(s *Subscription) error
- func (r *InMemRepository) FeedByName(name string) (*Feed, error)
- func (r *InMemRepository) Feeds() ([]*Feed, error)
- func (r *InMemRepository) ForceError(err error, delay int)
- func (r *InMemRepository) RemoveSub(subscription *Subscription) error
- func (r *InMemRepository) Subs(search SubSearchOpt) ([]*Subscription, error)
- func (r *InMemRepository) UpdateSub(s *Subscription) error
- type Item
- type MinimalFormatter
- type Notification
- type NullParser
- type ParsedFeed
- type Parser
- type Processor
- type Repository
- type SubSearchOpt
- type Subscription
- type Subscriptions
Constants ¶
View Source
const WordBoundary = `(?i)\b$WORD$\b`
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultFormatter ¶ added in v0.5.0
type DefaultFormatter struct { }
func (DefaultFormatter) Format ¶ added in v0.5.0
func (d DefaultFormatter) Format(notification Notification) string
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 (r *InMemRepository) AddFeed(feed *Feed) error
func (*InMemRepository) AddSub ¶
func (r *InMemRepository) AddSub(s *Subscription) error
func (*InMemRepository) FeedByName ¶
func (r *InMemRepository) FeedByName(name string) (*Feed, error)
func (*InMemRepository) Feeds ¶ added in v0.5.0
func (r *InMemRepository) Feeds() ([]*Feed, error)
func (*InMemRepository) ForceError ¶ added in v0.5.0
func (r *InMemRepository) ForceError(err error, delay int)
ForceError sets an error to be returned on the next called method. Used for forcing errors in testing.
func (*InMemRepository) RemoveSub ¶ added in v0.5.0
func (r *InMemRepository) RemoveSub(subscription *Subscription) error
func (*InMemRepository) Subs ¶ added in v0.5.0
func (r *InMemRepository) Subs(search SubSearchOpt) ([]*Subscription, error)
func (*InMemRepository) UpdateSub ¶
func (r *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) DescTruncated ¶ added in v0.5.0
func (*Item) HasKeywords ¶
type MinimalFormatter ¶ added in v0.5.0
type MinimalFormatter struct { }
func (MinimalFormatter) Format ¶ added in v0.5.0
func (m MinimalFormatter) Format(n Notification) string
type Notification ¶
func (Notification) String ¶
func (n Notification) String() string
type NullParser ¶ added in v0.5.0
type NullParser struct {
Parsed *ParsedFeed
}
func (*NullParser) ParseURL ¶ added in v0.5.0
func (p *NullParser) 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 { // Max notifications sent per channel per process. ChannelLimit int // contains filtered or unexported fields }
func NewProcessor ¶
func NewProcessor(repo Repository, parser Parser) *Processor
func (*Processor) Process ¶ added in v0.5.0
func (p *Processor) Process() ([]*Notification, error)
type Repository ¶
type Repository interface { Feeds() ([]*Feed, error) AddFeed(*Feed) error FeedByName(name string) (*Feed, error) AddSub(*Subscription) error UpdateSub(*Subscription) error RemoveSub(*Subscription) error Subs(search SubSearchOpt) ([]*Subscription, error) }
Repository TODO: AddFeed defined errors here for Repositories to use.
type SubSearchOpt ¶ added in v0.5.0
type Subscription ¶
type Subscription struct { Id uint64 FeedId uint64 User string Keywords string Ignore 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) IgnoreSlice ¶ added in v0.5.0
func (s *Subscription) IgnoreSlice() []string
func (*Subscription) KeywordsSlice ¶
func (s *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.