rss

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	Id            uint64
	Name          string
	Url           string
	LastPublished time.Time
}

Feeds are the allowed and available web feeds that users can subscribe to.

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) Desc

func (i *Item) Desc() string

func (*Item) HasKeywords

func (i *Item) HasKeywords(keywords []string) bool

type Notification

type Notification struct {
	Feed    Feed
	Item    Item
	Channel string
	Users   []string
}

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)
}

Directories

Path Synopsis
parsers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL