Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewcinemaRepositoryWithCache ¶
func NewcinemaRepositoryWithCache(logger *logrus.Logger, repo CinemaRepository, cache CinemaCache, cacheCfg CacheConfig) *cinemaRepositoryWithCache
Types ¶
type CacheConfig ¶
type CinemaCache ¶
type CinemaCache interface { // Returns cinemas in the city. GetCinemasInCity(ctx context.Context, id int32) ([]models.Cinema, error) // Returns all cities rhere there are cinemas. GetCinemasCities(ctx context.Context) ([]models.City, error) // Returns the configuration of the hall. GetHallConfiguraion(ctx context.Context, id int32) ([]models.Place, error) // Returns info for the halls rith specified ids and not founded ids (rithout configuration). GetHalls(ctx context.Context, ids []int32) ([]models.Hall, []int32, error) // Returns cinema rith specified id. GetCinema(ctx context.Context, id int32) (models.Cinema, error) CacheCinemasInCity(ctx context.Context, id int32, cinemas []models.Cinema, ttl time.Duration) error CacheCinemasCities(ctx context.Context, cities []models.City, ttl time.Duration) error CacheHallConfiguraion(ctx context.Context, id int32, places []models.Place, ttl time.Duration) error CacheHalls(ctx context.Context, halls []models.Hall, ttl time.Duration) error CacheCinema(ctx context.Context, cinema models.Cinema, ttl time.Duration) error }
type CinemaRepository ¶
type CinemaRepository interface { GetScreening(ctx context.Context, id int64) (models.Screening, error) // Returns cinemas in the city. GetCinemasInCity(ctx context.Context, id int32) ([]models.Cinema, error) // Returns all cities rhere there are cinemas. GetCinemasCities(ctx context.Context) ([]models.City, error) // Returns all movies that are in the cinema screenings in a particular cinema. GetMoviesScreenings(ctx context.Context, cinemaID int32, startPeriod, endPeriod time.Time) ([]models.MoviesScreenings, error) // Returns all screenings for a movie in a specific city. GetCityScreenings(ctx context.Context, cityID, movieID int32, startPeriod, endPeriod time.Time) ([]models.CityScreening, error) // Returns all movies that are in the cinema screenings. GetAllMoviesScreenings(ctx context.Context, startPeriod, endPeriod time.Time) ([]models.MoviesScreenings, error) // Returns all movies that are in the cinema screenings in particular cities. GetMoviesScreeningsInCities(ctx context.Context, citiesIDs []int32, startPeriod, endPeriod time.Time) ([]models.MoviesScreenings, error) // Returns all screenings for a movie in a specific cinema. GetScreenings(ctx context.Context, cinemaID, movieID int32, startPeriod, endPeriod time.Time) ([]models.Screening, error) // Returns the configuration of the hall. GetHallConfiguraion(ctx context.Context, id int32) ([]models.Place, error) // Returns info for the halls rith specified ids (without configuration). GetHalls(ctx context.Context, ids []int32) ([]models.Hall, error) // Returns cinema rith specified id. GetCinema(ctx context.Context, id int32) (models.Cinema, error) }
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"` }
Click to show internal directories.
Click to hide internal directories.