Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountAnime ¶
CountAnime returns a total amount of titles in the database
func SearchAnime ¶
func SearchAnime(params url.Values) (*[]AnimeModel, int64, error)
SearchAnime searches titles with given parameters. Query is not required. Retuns an AnimeModel array, total results count, and an error if any. If no anime was found returns an empty array.
Types ¶
type AnimeModel ¶
type AnimeModel struct { ID int64 `json:"_id" bson:"_id"` Title string `json:"title" bson:"title"` Summary string `json:"summary" bson:"summary"` Description string `json:"description" bson:"description"` Image string `json:"image_url" bson:"image_url"` Scores []Score `json:"scores" bson:"scores"` CreatedAt time.Time `json:"created_at" bson:"created_at"` }
AnimeModel is a database model of an anime.
func AddAnime ¶
func AddAnime(model AnimeModel) (*AnimeModel, error)
AddAnime inserts an anime to the database
func DeleteAnime ¶
func DeleteAnime(id int64) (*AnimeModel, error)
DeleteAnime deletes an anime from the database and returns a deleted document if any.
func GetAnimeByTitle ¶
func GetAnimeByTitle(title string) (*AnimeModel, error)
GetAnimeByTitle finds an anime by title, if not present returns ErrNoDocuments.
type Comment ¶
type Comment struct { Author string `json:"author"` Content string `json:"content"` CreatedAt time.Time `json:"created_at"` }
Comment is a comment model
type Score ¶
type Score struct { UserID int64 `json:"user_id" bson:"user_id"` Score int `json:"score" bson:"score"` }
Score is a database model of a score.
type SearchAnimeSettings ¶
SearchAnimeSettings is ... TODO
func NewSearchSettings ¶
func NewSearchSettings(params url.Values) (*SearchAnimeSettings, error)
NewSearchSettings TODO
func (*SearchAnimeSettings) GetFilter ¶
func (s *SearchAnimeSettings) GetFilter() *bson.M
Click to show internal directories.
Click to hide internal directories.