Documentation ¶
Overview ¶
Package db contains logic for interacting with the database
Index ¶
- Constants
- type Article
- type DB
- func (db *DB) DeleteOldArticles(ctx context.Context, project string, retrievedBefore time.Time) error
- func (db *DB) GetArticles(ctx context.Context, project string, offset, limit int, followerRead bool, ...) (_ []Article, newAsOf string, _ error)
- func (db *DB) UpsertArticle(ctx context.Context, a Article) error
Constants ¶
View Source
const (
DatabaseName = "wikifeedia"
)
View Source
const MaxConnections = 256
MaxConnections controls the maximum number of connections for a DB.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { Project string `json:"project"` Article string `json:"article"` Title string `json:"title"` ThumbnailURL string `json:"thumbnail_url"` Abstract string `json:"abstract"` ImageURL string `json:"image_url"` ArticleURL string `json:"article_url"` DailyViews int `json:"daily_views"` Retrieved time.Time `json:"retrieved"` }
Article is the data model for a Wikipedia article.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a wrapper around a pgx.ConnPool that knows about the structure of our application schema.
func (*DB) DeleteOldArticles ¶
func (db *DB) DeleteOldArticles( ctx context.Context, project string, retrievedBefore time.Time, ) error
DeleteOldArticles deletes articles which were retrieved before the specified time.
Click to show internal directories.
Click to hide internal directories.