feeds

package
v0.0.0-...-db93d88 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRss
)

Variables

View Source
var CreateSql = []string{
	`create table if not exists feeder (
	id integer primary key autoincrement,
	type integer,
	name text unique,
	url  text unique,
	time timestamp
)`,
	`create table if not exists fedentry (
	id integer primary key autoincrement,
	feeder integer,
	link   integer,
	title  integer,
	time   timestamp,
	unique (feeder, link),
	unique (feeder, title)
)`}
View Source
var ErrGetHTTP = fmt.Errorf("http get error")

Functions

func Create

func Create(db *sql.DB) error

func UpdateFeeder

func UpdateFeeder(db *sql.DB, name, url string) error

Types

type Channel

type Channel struct {
	Title         string `xml:"title"`
	Link          string `xml:"link"`
	Description   string `xml:"description"`
	Language      string `xml:"language"`
	LastBuildDate string `xml:"lastBuildDate"`
	Item          []Item `xml:"item"`
}

type Entry

type Entry struct {
	Item
}

func (*Entry) Html

func (e *Entry) Html() (io.Reader, error)

type FedEntry

type FedEntry struct {
	Id    int64
	Feed  int64
	Link  uint32
	Title uint32
	Time  time.Time
}

type Feed

type Feed struct {
	Channel Channel `xml:"channel"`
	Item    []Item  `xml:"item"`
}

func Read

func Read(r io.Reader) (*Feed, error)

func ReadHttp

func ReadHttp(url string) (*Feed, error)

func (*Feed) Entry

func (f *Feed) Entry(at int) *Entry

type Feeder

type Feeder struct {
	Id   int64
	Type int
	Name string
	Url  string
	Time *time.Time
}

func Feeders

func Feeders(db *sql.DB, where string, args ...interface{}) ([]Feeder, error)

func NewFeeder

func NewFeeder(db *sql.DB, name, url string) (*Feeder, error)

func (*Feeder) Entries

func (f *Feeder) Entries() ([]Entry, error)

func (*Feeder) Fed

func (f *Feeder) Fed(db *sql.DB, entries []Entry, now time.Time) error

func (*Feeder) Filter

func (f *Feeder) Filter(db *sql.DB, entries []Entry) ([]Entry, error)

func (*Feeder) Prune

func (f *Feeder) Prune(db *sql.DB, limit int) error

type Item

type Item struct {
	Title       string        `xml:"title"`
	Link        string        `xml:"link"`
	Comments    string        `xml:"comments"`
	PubDate     string        `xml:"pubDate"`
	GUID        string        `xml:"guid"`
	Category    []string      `xml:"category"`
	Enclosure   ItemEnclosure `xml:"enclosure"`
	Description string        `xml:"description"`
	Content     string        `xml:"content"`
	Encoded     string        `xml:"encoded"`
}

type ItemEnclosure

type ItemEnclosure struct {
	URL  string `xml:"url,attr"`
	Type string `xml:"type,attr"`
}

Jump to

Keyboard shortcuts

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