film

package
v0.0.0-...-2e53e79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadScore       Score = -1
	NeutralScore         = 0
	GoodScore            = 1
	ExcellentScore       = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	UserID    string    `firestore:"user_id" json:"user_id"`
	Text      string    `firestore:"text" json:"text"`
	CreatedAt time.Time `firestore:"created_at" json:"created_at"`
}

func ParseComment

func ParseComment(doc *firestore.DocumentSnapshot) (*Comment, error)

type Item

type Item struct {
	ID                       string           `firestore:"-" json:"id"`
	Title                    string           `firestore:"title,omitempty" json:"title"`
	TitleOriginal            string           `firestore:"title_original,omitempty" json:"title_original,omitempty"`
	Poster                   string           `firestore:"cover,omitempty" json:"cover,omitempty"`
	Cover                    string           `firestore:"poster,omitempty" json:"poster,omitempty"`
	Director                 string           `firestore:"director,omitempty" json:"director,omitempty"`
	Description              string           `firestore:"description,omitempty" json:"description,omitempty"`
	ShortDescription         string           `firestore:"short_description,omitempty" json:"short_description,omitempty"`
	Duration                 string           `firestore:"duration,omitempty" json:"duration,omitempty"`
	Scores                   map[string]Score `firestore:"scores" json:"scores,omitempty"`
	Comments                 []Comment        `firestore:"-" json:"comments,omitempty"`
	NoComments               bool             `firestore:"-" json:"-"`
	URL                      string           `firestore:"kinopoisk,omitempty" json:"kinopoisk,omitempty"`
	RatingKinopoisk          float64          `firestore:"rating_kinopoisk,omitempty" json:"rating_kinopoisk,omitempty"`
	RatingKinopoiskVoteCount int              `firestore:"rating_kinopoisk_vote_count,omitempty" json:"rating_kinopoisk_vote_count,omitempty"`
	RatingImdb               float64          `firestore:"rating_imdb,omitempty" json:"rating_imdb,omitempty"`
	RatingImdbVoteCount      int              `firestore:"rating_imdb_vote_count,omitempty" json:"rating_imdb_vote_count,omitempty"`
	Year                     int              `firestore:"year,omitempty" json:"year,omitempty"`
	FilmLength               int              `firestore:"film_length,omitempty" json:"film_length,omitempty"`
	Serial                   bool             `firestore:"serial" json:"serial"`
	ShortFilm                bool             `firestore:"short_film" json:"short_film"`
	Genres                   []string         `firestore:"genres,omitempty" json:"genres,omitempty"`
	UpdatedAt                time.Time        `firestore:"updated_at,omitempty" json:"updated_at,omitempty"`
	CreatedAt                time.Time        `firestore:"created_at,omitempty" json:"created_at,omitempty"`
}

Item TODO: user tags

func Parse

func Parse(doc *firestore.DocumentSnapshot) (*Item, error)

func (*Item) Average

func (f *Item) Average() Rate

func (*Item) Halva

func (f *Item) Halva() Rate

Halva = abs(Average) * Sum

func (*Item) Sum

func (f *Item) Sum() Rate

type Items

type Items []Item

func (Items) SortAverage

func (f Items) SortAverage()

func (Items) SortCreatedAt

func (f Items) SortCreatedAt()

func (Items) SortHalva

func (f Items) SortHalva()

func (Items) SortIMDB

func (f Items) SortIMDB()

func (Items) SortKinopoisk

func (f Items) SortKinopoisk()

func (Items) SortLexicographic

func (f Items) SortLexicographic()

func (Items) SortScoreNumber

func (f Items) SortScoreNumber()

func (Items) SortSum

func (f Items) SortSum()

func (Items) SortUpdatedAt

func (f Items) SortUpdatedAt()

type Rate

type Rate float64

func (Rate) Round

func (r Rate) Round() Rate

type Score

type Score int8

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL