Documentation ¶
Index ¶
- Variables
- func NewCountriesRepository(db *sqlx.DB, logger *logrus.Logger) *countriesRepository
- func NewGenresRepository(db *sqlx.DB, logger *logrus.Logger) *genresRepository
- func NewMoviesRepository(db *sqlx.DB, logger *logrus.Logger) *moviesRepository
- func NewPostgreDB(cfg DBConfig) (*sqlx.DB, error)
- type CountriesRepository
- type Country
- type CreateMovieParam
- type DBConfig
- type Genre
- type GenresRepository
- type IsMovieAlreadyExistsParam
- type Movie
- type MoviesFilter
- type MoviesRepository
- type UpdateMovieParam
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidArgument = errors.New("invalid input data")
View Source
var ErrNotFound = errors.New("entity not found")
Functions ¶
func NewCountriesRepository ¶
func NewGenresRepository ¶
func NewMoviesRepository ¶
Types ¶
type CountriesRepository ¶
type CountriesRepository interface { GetCountry(ctx context.Context, id int32) (Country, error) GetCountryByName(ctx context.Context, name string) (Country, error) GetCountries(ctx context.Context) ([]Country, error) GetCountriesForMovies(ctx context.Context, ids []int32) (map[int32][]string, error) GetCountriesForMovie(ctx context.Context, id int32) ([]string, error) CreateCountry(ctx context.Context, name string) (int32, error) DeleteCountry(ctx context.Context, id int32) error UpdateCountry(ctx context.Context, countryName string, id int32) error IsCountryExist(ctx context.Context, id int32) (bool, error) IsCountriesExists(ctx context.Context, ids []int32) (bool, []int32, error) IsCountryAlreadyExists(ctx context.Context, name string) (bool, int32, error) }
type CreateMovieParam ¶
type CreateMovieParam struct { TitleRU string `db:"title_ru"` TitleEN string `db:"title_en"` Description string `db:"description"` Genres []int32 `db:"genres"` Duration int32 `db:"duration"` PosterID string `db:"poster_picture_id"` PreviewPosterID string `db:"preview_poster_picture_id"` BackgroundPictureID string `db:"background_picture_id"` ShortDescription string `db:"short_description"` CountriesIDs []int32 `db:"countries"` ReleaseYear int32 `db:"release_year"` AgeRating int32 `db:"age_rating_id"` }
type DBConfig ¶
type DBConfig struct { Host string `yaml:"host" env:"DB_HOST"` Port string `yaml:"port" env:"DB_PORT"` Username string `yaml:"username" env:"DB_USERNAME"` Password string `yaml:"password" env:"DB_PASSWORD"` DBName string `yaml:"db_name" env:"DB_NAME"` SSLMode string `yaml:"ssl_mode" env:"DB_SSL_MODE"` }
type GenresRepository ¶
type GenresRepository interface { GetGenre(ctx context.Context, id int32) (Genre, error) GetGenreByName(ctx context.Context, name string) (Genre, error) GetGenres(ctx context.Context) ([]Genre, error) GetGenresForMovies(ctx context.Context, ids []int32) (map[int32][]string, error) GetGenresForMovie(ctx context.Context, id int32) ([]string, error) CreateGenre(ctx context.Context, name string) (int32, error) DeleteGenre(ctx context.Context, id int32) error UpdateGenre(ctx context.Context, name string, id int32) error IsGenreExist(ctx context.Context, id int32) (bool, error) IsGenreAlreadyExists(ctx context.Context, nameRU string) (bool, int32, error) IsGenresExists(ctx context.Context, ids []int32) (bool, []int32, error) }
type Movie ¶
type Movie struct { ID int32 `db:"id"` TitleRU string `db:"title_ru"` TitleEN sql.NullString `db:"title_en"` PreviewPosterID sql.NullString `db:"preview_poster_picture_id"` Description string `db:"description"` ShortDescription string `db:"short_description"` Duration int32 `db:"duration"` PosterID sql.NullString `db:"poster_picture_id"` BackgroundPictureID sql.NullString `db:"background_picture_id"` ReleaseYear int32 `db:"release_year"` AgeRating string `db:"age_rating"` }
type MoviesFilter ¶
type MoviesRepository ¶
type MoviesRepository interface { GetMovie(ctx context.Context, movieID int32) (Movie, error) GetMovies(ctx context.Context, Filter MoviesFilter, limit, offset uint32) ([]Movie, error) CreateMovie(ctx context.Context, param CreateMovieParam) (int32, error) IsMovieAlreadyExists(ctx context.Context, existParam IsMovieAlreadyExistsParam) (bool, []int32, error) UpdatePictures(ctx context.Context, id int32, posterNameID, previewPosterID, backgroundID string) error UpdateMovie(ctx context.Context, id int32, param UpdateMovieParam, genres, countries []int32, updateGenres, updateCountries bool) error GetPicturesIds(ctx context.Context, id int32) (poster, preview, background string, err error) IsMovieExists(ctx context.Context, id int32) (bool, error) DeleteMovie(ctx context.Context, id int32) error GetAgeRatings(ctx context.Context) ([]string, error) GetAgeRating(ctx context.Context, name string) (int32, error) IsAgeRatingAlreadyExists(ctx context.Context, name string) (bool, error) CreateAgeRating(ctx context.Context, name string) error DeleteAgeRating(ctx context.Context, name string) error GetMovieDuration(ctx context.Context, id int32) (uint32, error) GetMoviesDuration(ctx context.Context, ids []int32) (map[int32]uint32, error) }
type UpdateMovieParam ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.