Documentation
¶
Index ¶
- type CreateMovieRequest
- type CreateMovieService
- type DeleteMovieResponse
- type DeleteMovieService
- type FindMovieService
- type LoggerRequest
- type LoggerResponse
- type LoggerService
- type MovieResponse
- type MovieSelector
- type MovieTransactor
- type PingResponse
- type PingService
- type Pinger
- type RandomStringGenerator
- type UpdateMovieRequest
- type UpdateMovieService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateMovieRequest ¶
type CreateMovieRequest struct {
Title string `json:"title"`
Rated string `json:"rated"`
Released string `json:"release_date"`
RunTime int `json:"run_time"`
Director string `json:"director"`
Writer string `json:"writer"`
}
CreateMovieRequest is the request struct for Creating a Movie
type CreateMovieService ¶
type CreateMovieService struct {
RandomStringGenerator RandomStringGenerator
MovieTransactor MovieTransactor
}
CreateMovieService is a service for creating a Movie
func NewCreateMovieService ¶
func NewCreateMovieService(rsg RandomStringGenerator, mt MovieTransactor) *CreateMovieService
NewCreateMovieService is an initializer for CreateMovieService
func (CreateMovieService) Create ¶
func (cms CreateMovieService) Create(ctx context.Context, r *CreateMovieRequest, u user.User) (MovieResponse, error)
Create is used to create a Movie
type DeleteMovieResponse ¶
type DeleteMovieResponse struct {
ExternalID string `json:"extl_id"`
Deleted bool `json:"deleted"`
}
DeleteMovieResponse is the response struct for deleted Movies
type DeleteMovieService ¶
type DeleteMovieService struct {
MovieSelector MovieSelector
MovieTransactor MovieTransactor
}
DeleteMovieService is a service for deleting a Movie
func NewDeleteMovieService ¶
func NewDeleteMovieService(ms MovieSelector, mt MovieTransactor) *DeleteMovieService
NewDeleteMovieService is an initializer for DeleteMovieService
func (DeleteMovieService) Delete ¶
func (dms DeleteMovieService) Delete(ctx context.Context, extlID string) (DeleteMovieResponse, error)
Delete is used to delete a movie
type FindMovieService ¶
type FindMovieService struct {
MovieSelector MovieSelector
}
FindMovieService is a service for reading a Movie from the DB
func NewFindMovieService ¶
func NewFindMovieService(ms MovieSelector) *FindMovieService
NewFindMovieService is an initializer for FindMovieService
func (FindMovieService) FindAllMovies ¶
func (fms FindMovieService) FindAllMovies(ctx context.Context) ([]MovieResponse, error)
FindAllMovies is used to list all movies in the db
func (FindMovieService) FindMovieByID ¶
func (fms FindMovieService) FindMovieByID(ctx context.Context, extlID string) (MovieResponse, error)
FindMovieByID is used to find an individual movie
type LoggerRequest ¶
type LoggerRequest struct {
GlobalLogLevel string `json:"global_log_level"`
LogErrorStack string `json:"log_error_stack"`
}
LoggerRequest is the request struct for the app logger
type LoggerResponse ¶
type LoggerResponse struct {
LoggerMinimumLevel string `json:"logger_minimum_level"`
GlobalLogLevel string `json:"global_log_level"`
LogErrorStack bool `json:"log_error_stack"`
}
LoggerResponse is the response struct for the current state of the app logger
type LoggerService ¶
LoggerService reads and updates the logger state
func NewLoggerService ¶
func NewLoggerService(logger zerolog.Logger) *LoggerService
NewLoggerService is an initializer for LoggerService
func (LoggerService) Read ¶
func (ls LoggerService) Read() LoggerResponse
ReadLogger handles GET requests for the /logger endpoint
func (LoggerService) Update ¶
func (ls LoggerService) Update(r *LoggerRequest) (LoggerResponse, error)
Update handles PUT requests for the /logger endpoint and updates the logger globals
type MovieResponse ¶
type MovieResponse struct {
ExternalID string `json:"external_id"`
Title string `json:"title"`
Rated string `json:"rated"`
Released string `json:"release_date"`
RunTime int `json:"run_time"`
Director string `json:"director"`
Writer string `json:"writer"`
CreateUsername string `json:"create_username"`
CreateTimestamp string `json:"create_timestamp"`
UpdateUsername string `json:"update_username"`
UpdateTimestamp string `json:"update_timestamp"`
}
MovieResponse is the response struct for a Movie
type MovieSelector ¶
type MovieSelector interface {
FindByID(context.Context, string) (*movie.Movie, error)
FindAll(context.Context) ([]*movie.Movie, error)
}
MovieSelector reads Movie records from the db
type MovieTransactor ¶
type MovieTransactor interface {
Create(ctx context.Context, m *movie.Movie) error
Update(ctx context.Context, m *movie.Movie) error
Delete(ctx context.Context, m *movie.Movie) error
}
MovieTransactor is the interface that wraps the DML actions for a Movie in the DB
type PingResponse ¶
type PingResponse struct {
DBUp bool `json:"db_up"`
}
PingResponse is the response struct for the PingService
type PingService ¶
type PingService struct {
Pinger Pinger
}
PingService pings the database.
func NewPingService ¶
func NewPingService(p Pinger) *PingService
NewPingService is an initializer for PingService
func (PingService) Ping ¶
func (p PingService) Ping(ctx context.Context, logger zerolog.Logger) PingResponse
Ping method pings the database
type RandomStringGenerator ¶
RandomStringGenerator is the interface that generates random strings
type UpdateMovieRequest ¶
type UpdateMovieRequest struct {
ExternalID string
Title string `json:"title"`
Rated string `json:"rated"`
Released string `json:"release_date"`
RunTime int `json:"run_time"`
Director string `json:"director"`
Writer string `json:"writer"`
}
UpdateMovieRequest is the request struct for updating a Movie
type UpdateMovieService ¶
type UpdateMovieService struct {
MovieTransactor MovieTransactor
}
UpdateMovieService is a service for updating a Movie
func NewUpdateMovieService ¶
func NewUpdateMovieService(mt MovieTransactor) *UpdateMovieService
NewUpdateMovieService is an initializer for UpdateMovieService
func (UpdateMovieService) Update ¶
func (ums UpdateMovieService) Update(ctx context.Context, r *UpdateMovieRequest, u user.User) (MovieResponse, error)
Update is used to update a movie