Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Listing ¶
Listing will handle datastore interface for the subreddit listing data.
func (*Listing) Store ¶
func (p *Listing) Store(ctx context.Context, listings []SubredditListing) error
Store will store the data listing from a subreddit
func (*Listing) SubredditPosts ¶
func (p *Listing) SubredditPosts(ctx context.Context, subreddit string, limit int) ([]SubredditPost, error)
SubredditPosts will return the authors with the most posts for a given subreddit. The limit is optional and if none are provided, a default will be used.
func (*Listing) SubredditUps ¶
func (p *Listing) SubredditUps(ctx context.Context, subreddit string, limit int) ([]SubredditListing, error)
SubredditUps will return the subreddit posts with the most ups (up votes). The limit is optional and if none are provided, a default will be used.
type SubredditListing ¶
type SubredditListing struct { Title string `db:"TITLE"` Downs int `db:"DOWNS"` UpvoteRatio float64 `db:"UPVOTE_RATIO"` Ups int `db:"UPS"` TotalAwardsReceived int `db:"TOTAL_AWARDS"` Name string `db:"NAME"` Subreddit string `db:"SUBREDDIT"` ID string `db:"ID"` Author string `db:"AUTHOR"` AuthorFullname string `db:"AUTHOR_FULLNAME"` }
SubredditListing is the database model for the subreddit listing
type SubredditPost ¶
type SubredditPost struct { Author string `json:"author" db:"AUTHOR"` AuthorFullname string `json:"author_fullname" db:"AUTHOR_FULLNAME"` Posts int `json:"posts" db:"POSTS"` }
SubredditPost is the database model for the author's subreddit posts
Click to show internal directories.
Click to hide internal directories.