Documentation
¶
Overview ¶
Package model contains data for reaction.pics
Index ¶
- Constants
- type Board
- func (b *Board) AddPost(p Post)
- func (b Board) FilterBoard(queries []string) *Board
- func (b Board) GetPostByID(postID int64) *Post
- func (b Board) Keywords() []string
- func (b *Board) LimitBoard(offset, maxResults int)
- func (b Board) MarshalJSON() ([]byte, error)
- func (b *Board) PopulateBoard()
- func (b *Board) RandomizePosts()
- func (b *Board) SortPostsByLikes()
- func (b Board) URLs() []string
- type Post
Constants ¶
const (
MaxKeywords = 20
)
MaxKeywords is the maximum number of keywords that can be returned by a board
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Board ¶
type Board struct {
Posts []Post
// contains filtered or unexported fields
}
Board is a container for Posts that offers serialization, sorting, and parallelization
func InitializeBoard ¶
func InitializeBoard() *Board
InitializeBoard means to create a new board and start writing reading saved posts into it
func (*Board) AddPost ¶
AddPost adds a single post to the board; no-ops if the post is already present
func (Board) FilterBoard ¶
FilterBoard returns a new Board with a subset of posts filtered by a string
func (Board) GetPostByID ¶
GetPostByID returns a post that matches the postID
func (*Board) LimitBoard ¶
LimitBoard modifies the current board with maxResults posts starting at offset
func (Board) MarshalJSON ¶
MarshalJSON allows Board to be converted to json
func (*Board) PopulateBoard ¶
func (b *Board) PopulateBoard()
PopulateBoard adds production posts to the board
func (*Board) RandomizePosts ¶
func (b *Board) RandomizePosts()
RandomizePosts will shuffle the current Board's posts
func (*Board) SortPostsByLikes ¶
func (b *Board) SortPostsByLikes()
SortPostsByLikes sorts Posts in reverse number of likes order
type Post ¶
type Post struct {
ID int64 `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
Image string `json:"image"`
Likes int64 `json:"likes"`
}
Post is a representation of a single tumblr post
func ReadPostsFromCSV ¶
ReadPostsFromCSV reads a CSV file into a list of posts
func (Post) InternalURL ¶
InternalURL returns the path to the post
func (Post) MarshalJSON ¶
MarshalJSON allows Post to be converted to json