film

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

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilmRedisRepo

type FilmRedisRepo struct {
	Connection bool
	// contains filtered or unexported fields
}

func GetFilmRedisRepo

func GetFilmRedisRepo(NearFilmCfg configs.DbRedisCfg, lg *slog.Logger) (*FilmRedisRepo, error)

func (*FilmRedisRepo) AddNearFilm

func (redisRepo *FilmRedisRepo) AddNearFilm(ctx context.Context, active models.NearFilm, lg *slog.Logger) (bool, error)

func (*FilmRedisRepo) CheckActiveNearFilm

func (redisRepo *FilmRedisRepo) CheckActiveNearFilm(ctx context.Context, uid string, fid string, lg *slog.Logger) (bool, error)

func (*FilmRedisRepo) CheckRedisNearFilmConnection

func (redisRepo *FilmRedisRepo) CheckRedisNearFilmConnection(NearFilmCfg configs.DbRedisCfg)

func (*FilmRedisRepo) DeleteNearFilm

func (redisRepo *FilmRedisRepo) DeleteNearFilm(ctx context.Context, uid string, fid string, lg *slog.Logger) (bool, error)

func (*FilmRedisRepo) GetNearFilms

func (redisRepo *FilmRedisRepo) GetNearFilms(ctx context.Context, uid string, lg *slog.Logger) ([]models.NearFilm, error)

type IFilmsRepo

type IFilmsRepo interface {
	GetFilmsByGenre(genre uint64, start uint64, end uint64) ([]models.FilmItem, error)
	GetFilms(start uint64, end uint64) ([]models.FilmItem, error)
	GetFilm(filmId uint64) (*models.FilmItem, error)
	GetFilmRating(filmId uint64) (float64, uint64, error)
	FindFilm(title string, dateFrom string, dateTo string, ratingFrom float32, ratingTo float32,
		mpaa string, genres []uint32, actors []string, first uint64, limit uint64,
	) ([]models.FilmItem, error)
	GetFavoriteFilms(userId uint64, start uint64, end uint64) ([]models.FilmItem, error)
	AddFavoriteFilm(userId uint64, filmId uint64) error
	RemoveFavoriteFilm(userId uint64, filmId uint64) error
	CheckFilm(userId uint64, filmId uint64) (bool, error)
	AddRating(filmId uint64, userId uint64, rating uint16) error
	HasUsersRating(userId uint64, filmId uint64) (bool, error)
	AddFilm(film models.FilmItem) error
	GetFilmId(title string) (uint64, error)
	DeleteRating(idUser uint64, idFilm uint64) error
	Trends() ([]models.FilmItem, error)
	GetLasts(ids []uint64) ([]models.FilmItem, error)
}

type RepoPostgre

type RepoPostgre struct {
	// contains filtered or unexported fields
}

func GetFilmRepo

func GetFilmRepo(config *configs.DbDsnCfg, lg *slog.Logger) (*RepoPostgre, error)

func (*RepoPostgre) AddFavoriteFilm

func (repo *RepoPostgre) AddFavoriteFilm(userId uint64, filmId uint64) error

func (*RepoPostgre) AddFilm

func (repo *RepoPostgre) AddFilm(film models.FilmItem) error

func (*RepoPostgre) AddRating

func (repo *RepoPostgre) AddRating(filmId uint64, userId uint64, rating uint16) error

func (*RepoPostgre) CheckFilm

func (repo *RepoPostgre) CheckFilm(userId uint64, filmId uint64) (bool, error)

func (*RepoPostgre) DeleteRating

func (repo *RepoPostgre) DeleteRating(idUser uint64, idFilm uint64) error

func (*RepoPostgre) FindFilm

func (repo *RepoPostgre) FindFilm(title string, dateFrom string, dateTo string, ratingFrom float32, ratingTo float32,
	mpaa string, genres []uint32, actors []string, first uint64, limit uint64,
) ([]models.FilmItem, error)

func (*RepoPostgre) GetFavoriteFilms

func (repo *RepoPostgre) GetFavoriteFilms(userId uint64, start uint64, end uint64) ([]models.FilmItem, error)

func (*RepoPostgre) GetFilm

func (repo *RepoPostgre) GetFilm(filmId uint64) (*models.FilmItem, error)

func (*RepoPostgre) GetFilmId

func (repo *RepoPostgre) GetFilmId(title string) (uint64, error)

func (*RepoPostgre) GetFilmRating

func (repo *RepoPostgre) GetFilmRating(filmId uint64) (float64, uint64, error)

func (*RepoPostgre) GetFilms

func (repo *RepoPostgre) GetFilms(start uint64, end uint64) ([]models.FilmItem, error)

func (*RepoPostgre) GetFilmsByGenre

func (repo *RepoPostgre) GetFilmsByGenre(genre uint64, start uint64, end uint64) ([]models.FilmItem, error)

func (*RepoPostgre) GetLasts

func (repo *RepoPostgre) GetLasts(ids []uint64) ([]models.FilmItem, error)

func (*RepoPostgre) HasUsersRating

func (repo *RepoPostgre) HasUsersRating(userId uint64, filmId uint64) (bool, error)

func (*RepoPostgre) RemoveFavoriteFilm

func (repo *RepoPostgre) RemoveFavoriteFilm(userId uint64, filmId uint64) error

func (*RepoPostgre) Trends

func (repo *RepoPostgre) Trends() ([]models.FilmItem, error)

Jump to

Keyboard shortcuts

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