mylib

package
v0.0.0-...-4524d0c Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Unlicense, Unlicense Imports: 14 Imported by: 0

Documentation

Overview

RSS: http://stackoverflow.com/questions/15245896/rss-update-single-item http://stackoverflow.com/questions/164124/rss-item-updates SQLite: http://golang.org/pkg/database/sql/ https://github.com/mattn/go-sqlite3 http://stackoverflow.com/questions/3634984/insert-if-not-exists-else-update http://stackoverflow.com/questions/2251699/sqlite-insert-or-replace-into-vs-update-where http://stackoverflow.com/questions/1601151/how-do-i-check-in-sqlite-whether-a-table-exists http://stackoverflow.com/questions/19337029/insert-if-not-exists-statement-in-sqlite http://stackoverflow.com/questions/6740733/insert-or-replace-is-creating-duplicates http://stackoverflow.com/questions/12105198/sqlite-how-to-get-insert-or-ignore-to-work http://stackoverflow.com/questions/19134274/sqlitedatabase-insert-or-replace-if-changed http://stackoverflow.com/questions/14091183/sqlite-order-by-date http://stackoverflow.com/questions/15473325/inserting-current-date-and-time-in-sqlite-database http://stackoverflow.com/questions/7316747/sqlite-inserting-bool-value

Poll RSS/ATOM seeds

^C event handling http://stackoverflow.com/questions/11268943/golang-is-it-possible-to-capture-a-ctrlc-signal-and-run-a-cleanup-function-in

A Tour of Go - Concurrency http://tour.golang.org/#64

http://stackoverflow.com/questions/10510691/how-to-check-whether-a-file-or-directory-denoted-by-a-path-exists-in-golang http://stackoverflow.com/questions/14249467/os-mkdir-and-os-mkdirall-permission-value http://stackoverflow.com/questions/1760757/how-to-efficiently-concatenate-strings-in-go

http://www.w3schools.com/rss/default.asp http://www.tutorialspoint.com/rss/what-is-atom.htm http://stackoverflow.com/questions/6619717/what-is-the-difference-between-rss-and-atom-feeds http://stackoverflow.com/questions/16309944/atom-to-rss-feeds-converter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTemplate

func GetTemplate(filepath string) *template.Template

func InitDB

func InitDB(filepath string) *sql.DB

func Poll

func Poll(sites []OpmlOutline)

func SaveLinkAsJson

func SaveLinkAsJson(l LinkInfo)

func XmlUrl2DBPath

func XmlUrl2DBPath(xmlUrl string) string

Types

type Atom1

type Atom1 struct {
	XMLName   xml.Name `xml:"http://www.w3.org/2005/Atom feed"`
	Title     string   `xml:"title"`
	Subtitle  string   `xml:"subtitle"`
	Id        string   `xml:"id"`
	Updated   string   `xml:"updated"`
	Rights    string   `xml:"rights"`
	Link      Link     `xml:"link"`
	Author    Author   `xml:"author"`
	EntryList []Entry  `xml:"entry"`
}

http://en.wikipedia.org/wiki/Atom_(standard) http://golang.org/src/pkg/encoding/xml/

type Author

type Author struct {
	Name  string `xml:"name"`
	Email string `xml:"email"`
}

type Entry

type Entry struct {
	Title   string `xml:"title"`
	Summary string `xml:"summary"`
	Content string `xml:"content"`
	Id      string `xml:"id"`
	Updated string `xml:"updated"`
	Link    Link   `xml:"link"`
	Author  Author `xml:"author"`
}

type Item

type Item struct {
	// Required
	Title       string        `xml:"title"`
	Link        string        `xml:"link"`
	Description template.HTML `xml:"description"`
	// Optional
	Content  template.HTML `xml:"encoded"`
	PubDate  string        `xml:"pubDate"`
	Comments string        `xml:"comments"`
	// for reader only
	IsRead       bool
	ReadDatetime string
}

http://www.w3schools.com/rss/rss_item.asp http://stackoverflow.com/questions/7220670/difference-between-description-and-contentencoded-tags-in-rss2 https://groups.google.com/d/topic/golang-nuts/uBMo1BpaQCM

func GetItemsFromDB

func GetItemsFromDB(xmlUrl string) []Item

func ReadItems

func ReadItems(db *sql.DB) []Item
type Link struct {
	Href string `xml:"href,attr"`
}

type LinkInfo

type LinkInfo struct {
	// required
	Title    string
	Link     string
	Tag      string
	Language string
	// optional
	HNComments string
}

type Opml

type Opml struct {
	XMLName xml.Name `xml:"opml"`
	Version string   `xml:"version,attr"`
	Head    OpmlHead
	Body    OpmlBody
}

type OpmlBody

type OpmlBody struct {
	XMLName  xml.Name      `xml:"body"`
	SiteList []OpmlOutline `xml:"outline"`
}

type OpmlHead

type OpmlHead struct {
	XMLName xml.Name `xml:"head"`
	Title   string   `xml:"title"`
}

type OpmlOutline

type OpmlOutline struct {
	Text    string `xml:"text,attr"`
	Title   string `xml:"title,attr"`
	Type    string `xml:"type,attr"`
	XmlUrl  string `xml:"xmlUrl,attr"`
	HtmlUrl string `xml:"htmlUrl,attr"`
	Favicon string `xml:"rssfr-favicon,attr"`
}

func GetOutlineList

func GetOutlineList(filepath string) []OpmlOutline

func GetSites

func GetSites(dbpath string) []OpmlOutline

type Rss2

type Rss2 struct {
	XMLName xml.Name `xml:"rss"`
	Version string   `xml:"version,attr"`
	// Required
	Title       string `xml:"channel>title"`
	Link        string `xml:"channel>link"`
	Description string `xml:"channel>description"`
	// Optional
	PubDate  string `xml:"channel>pubDate"`
	ItemList []Item `xml:"channel>item"`
}

http://www.w3schools.com/rss/rss_syntax.asp http://www.w3schools.com/rss/rss_channel.asp

func GetSeed

func GetSeed(url string) (Rss2, bool)

Jump to

Keyboard shortcuts

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