feedtrigger

package module
v0.0.0-...-15b5fef Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package feedtrigger is a simple library which is aimed to handle new RSS/Atom entries by using a trigger function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogAuthorAndLink(i *gofeed.Item) error

LogAuthorAndLink of the new item.

Types

type Feed

type Feed struct {
	URL           string
	OnNewRecord   NewItemAction
	RefreshPeriod time.Duration
}

Feed to poll (Atom/RSS).

func NewFeed

func NewFeed(url string, action NewItemAction) *Feed

NewFeed returns a feed by URL with default refresh period of 1 minute.

type FeedAction

type FeedAction struct {
	Store gokv.Store
	Feeds []Feed
	sync.Mutex
}

FeedAction is a the main configuration struct.

func New

func New(s gokv.Store, ff ...Feed) (*FeedAction, error)

New application builder.

func (*FeedAction) Run

func (a *FeedAction) Run(ctx context.Context) error

Run polling and processing loop.

type FeedHead

type FeedHead struct {
	Title     string `json:"title,omitempty"`
	Updated   string `json:"last_updated,omitempty"`
	Published string `json:"published,omitempty"`
}

FeedHead is the top item of the feed. It's needed for checking for updates on every poll.

type NewItemAction

type NewItemAction func(*gofeed.Item) error

NewItemAction is triggered, when new item is available.

type Person

type Person struct {
	*gofeed.Person
}

Person from the feed.

func NewPerson

func NewPerson(p *gofeed.Person) *Person

/ NewPerson gives us a builder pattern.

func (*Person) String

func (p *Person) String() string

String interface implementation for Person.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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