Documentation ¶
Index ¶
- Constants
- type SQLArtIter
- type SQLStore
- func (ss *SQLStore) Close()
- func (ss *SQLStore) Fetch(filt *store.Filter) store.ArtIter
- func (ss *SQLStore) FetchArt(artID int) (*store.Article, error)
- func (ss *SQLStore) FetchCount(filt *store.Filter) (int, error)
- func (ss *SQLStore) FetchPublications() ([]store.Publication, error)
- func (ss *SQLStore) FetchSummary(filt *store.Filter, group string) ([]store.DatePubCount, error)
- func (ss *SQLStore) FindURLs(urls []string) ([]int, error)
- func (ss *SQLStore) Stash(arts ...*store.Article) ([]int, error)
- func (ss *SQLStore) WhichAreNew(artURLs []string) ([]string, error)
Constants ¶
const ( UNKNOWN = iota QUESTION DOLLAR NAMED AT )
Bindvar types supported by Rebind, BindMap and BindStruct.
const ( DUNNO = iota RESULT // use Result.LastInsertID() RETURNING // use sql "RETURNING" clause )
Which method to use to get last insert IDs
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLArtIter ¶
type SQLArtIter struct {
// contains filtered or unexported fields
}
func (*SQLArtIter) Article ¶
func (it *SQLArtIter) Article() *store.Article
func (*SQLArtIter) Close ¶
func (it *SQLArtIter) Close() error
func (*SQLArtIter) Err ¶
func (it *SQLArtIter) Err() error
func (*SQLArtIter) Next ¶
func (it *SQLArtIter) Next() bool
if it returns true there will be an article.
type SQLStore ¶
type SQLStore struct { ErrLog store.Logger DebugLog store.Logger // contains filtered or unexported fields }
SQLStore stashes articles in an SQL database
func NewWithEnv ¶
Same as New(), but if driver or connStr is missing, will try and read them from environment vars: SCRAPEOMAT_DRIVER & SCRAPEOMAT_DB. If both driver and SCRAPEOMAT_DRIVER are empty, default is "sqlite3".
func (*SQLStore) FetchPublications ¶
func (ss *SQLStore) FetchPublications() ([]store.Publication, error)
func (*SQLStore) FetchSummary ¶
func (*SQLStore) FindURLs ¶
FindURLs Looks up article urls, returning a list of matching article IDs. usually you'd use this on the URLs for a single article, expecting zero or one IDs back, but there's no reason you can't look up a whole bunch of articles at once, although you won't know which ones match which URLs. remember that there can be multiple URLs for a single article, AND also multiple articles can share the same URL (hopefully much much more rare).