Documentation ¶
Index ¶
- type ArtID
- type ArtList
- type Article
- func (art *Article) AddTag(tag string) bool
- func (art *Article) BylineString() string
- func (art *Article) Day() string
- func (art *Article) FieldString(fieldName string) string
- func (art *Article) FormatContent(highlightTerms string) string
- func (art *Article) FormattedPubDate(fmt string) string
- func (art *Article) GetURL(n int) string
- func (art *Article) KeywordsString() string
- func (art *Article) LinksString() string
- func (art *Article) NumURLs() int
- func (art *Article) PlainTextContent() string
- func (art *Article) PublishedTime() time.Time
- func (art *Article) RemoveTag(tag string) bool
- func (art *Article) TagsString() string
- func (art *Article) TextContent() template.HTML
- func (art *Article) URL() string
- type Author
- type Batch
- type By
- type Iter
- type Logger
- type Match
- type ProgressFn
- type Publication
- type SortOrder
- type Stasher
- type Store
- func Create(dbFile string, dbug Logger, defaultLang string, loc *time.Location) (*Store, error)
- func New(dbFile string, dbug Logger, defaultLang string, loc *time.Location) (*Store, error)
- func NewWithoutIndex(dbFile string, dbug Logger, defaultLang string, loc *time.Location) (*Store, error)
- func Open(dbFile string, dbug Logger, defaultLang string, loc *time.Location) (*Store, error)
- func (store *Store) AddTags(arts ArtList, tags []string) (ArtList, error)
- func (store *Store) AllArts() (ArtList, error)
- func (store *Store) BeginBatch() (*Batch, error)
- func (store *Store) Close()
- func (store *Store) DB() *sql.DB
- func (store *Store) Delete(arts ArtList, progress ProgressFn) error
- func (store *Store) Fetch(artIDs ...ArtID) ([]*Article, error)
- func (store *Store) FetchAll() ([]*Article, error)
- func (store *Store) Filename() string
- func (store *Store) FindArt(urls []string) (ArtID, error)
- func (store *Store) IterateAllArts() *Iter
- func (store *Store) IterateArts(arts ...ArtID) *Iter
- func (store *Store) IterateTaggedArts() *Iter
- func (store *Store) Lang() string
- func (store *Store) RemoveTags(arts ArtList, tags []string) (ArtList, error)
- func (store *Store) Search(queryString string) (ArtList, error)
- func (store *Store) SetLang(lang string) error
- func (store *Store) Sort(artIDs ArtList, fieldName string, order SortOrder) (ArtList, error)
- func (store *Store) Stash(arts []*Article) error
- func (store *Store) TotalArts() int
- func (store *Store) UpdateLinks(arts ArtList) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtList ¶
type ArtList []ArtID
ArtList is a list of article IDs from a Store.
func (ArtList) Intersection ¶
func (ArtList) StringList ¶
type Article ¶
type Article struct { ID ArtID // id in local sqlite db CanonicalURL string URLs []string Headline string Authors []Author // Content contains HTML, sanitised using a subset of tags Content string Published string Updated string Publication Publication // Hack for now: store keywords as strings to work around badger shortcomings // TODO: Restore full structure // Keywords []Keyword Keywords []string Section string Tags []string // List of articles similar to this one. Similar []Match // a couple of tweet-specific bits Retweets int Favourites int // resolved links Links []string // fudge fields Pub string Byline string }
func (*Article) BylineString ¶
func (*Article) FieldString ¶
func (*Article) FormatContent ¶
TODO: this should be out in the gui layer TODO: this will screw up in assorted cases
eg a highlight term of "amp" will cause & escape codes to bork up.
func (*Article) FormattedPubDate ¶
func (*Article) KeywordsString ¶
func (*Article) LinksString ¶
func (*Article) PlainTextContent ¶
func (*Article) PublishedTime ¶
func (*Article) TagsString ¶
func (*Article) TextContent ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch is a helper for performing operations upon the store. TODO: - add logging for bad/partly bad articles - track articles we already had
func (*Batch) ClearSimilar ¶
type ProgressFn ¶
type Publication ¶
type Stasher ¶
type Stasher struct { Dest *Store BatchSize int // StashedIDs contains IDs of successfully-stashed articles StashedIDs ArtList // contains filtered or unexported fields }
Stasher is a helper for loading articles into a store. It batches up stashes, to improve indexing speed. TODO: - add logging for bad/partly bad articles - track articles we already had
func NewStasher ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the core representation of our data set. Provides base methods for querying, tagging, whatever
func New ¶
DEPRECATED - use Open() or Create() instead defaultLang is lang used when creating a new db (or updating an older version). Otherwise Lang set from existing DB.
func NewWithoutIndex ¶
func NewWithoutIndex(dbFile string, dbug Logger, defaultLang string, loc *time.Location) (*Store, error)
NewWithoutIndex opens a store without a fulltext interface
func (*Store) BeginBatch ¶
func (*Store) Delete ¶
func (store *Store) Delete(arts ArtList, progress ProgressFn) error
Delete articles from the store (and index) if progress is non-nil, it'll be called at regularish intervals
func (*Store) IterateAllArts ¶
func (*Store) IterateArts ¶
IterateArts returns an Iter which steps over each article in turn
func (*Store) IterateTaggedArts ¶
func (*Store) RemoveTags ¶
func (*Store) SetLang ¶
set the default indexing language for this store NOTE: won't take effect unless index is deleted and rebuilt...
func (*Store) UpdateLinks ¶
HACK - update all the links for the given articles