feed

package
v0.0.0-...-6c418b8 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEntryHasNoLink = errors.New("entry has no link")

Functions

func BackfillSendingEntry

func BackfillSendingEntry(
	ctx context.Context,
	srv *services.Services,
	to string,
	entry EntryWithSourceTitle,
) error

func DownloadNewFeedEntries

func DownloadNewFeedEntries(
	ctx context.Context,
	srv *services.Services,
	feedURLs []string,
) error

DownloadNewFeedEntries downloads RSS feeds from the passed in list and stores all new articles into the SQLite database.

func ParseFeedsList

func ParseFeedsList(feedsList string) ([]string, error)

ParseFeedsList reads the list of feeds from the `feedsList` file and returns a parsed list.

func SendEntry

func SendEntry(
	ctx context.Context,
	srv *services.Services,
	to string,
	entry EntryWithSourceTitle,
) error

Types

type Entry

type Entry struct {
	ID          int    `db:"id"`
	FeedID      int    `db:"source_id"`
	Link        string `db:"link"`
	PublishedOn string `db:"published_on"`
	Title       string `db:"title"`
	Description string `db:"description"`
	Content     string `db:"content"`
}

func TestFeedEntry

func TestFeedEntry(t *testing.T, srv *services.Services, feed Feed) Entry

type EntryWithSourceTitle

type EntryWithSourceTitle struct {
	Entry
	SourceTitle string `db:"source_title"`
}

func ReadNewEntries

func ReadNewEntries(ctx context.Context, srv *services.Services, notSentTo string) ([]EntryWithSourceTitle, error)

ReadNewEntries returns all feed entries that have not yet been sent out over email.

type Feed

type Feed struct {
	ID      int    `db:"id"`
	Link    string `db:"link"`
	Title   string `db:"title"`
	Authors string `db:"authors"`
}

func TestFeedSource

func TestFeedSource(t *testing.T, srv *services.Services) Feed

type SentEmail

type SentEmail struct {
	ID      int       `db:"id"`
	EntryID int       `db:"entry_id"`
	ToEmail string    `db:"to_email"`
	SentOn  time.Time `db:"sent_on"`
}

func TestSentEmail

func TestSentEmail(t *testing.T, srv *services.Services, entry Entry, to string) SentEmail

Jump to

Keyboard shortcuts

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