Documentation ¶
Index ¶
- type HandlerResponse
- func Created(payload interface{}) HandlerResponse
- func InternalServerError(serviceName, functionName string, err error) HandlerResponse
- func NoContent() HandlerResponse
- func NotFound(serviceName, functionName string, err error) HandlerResponse
- func Ok(payload interface{}) HandlerResponse
- func UnprocessableEntity(serviceName, functionName string, fieldErrors []common.FieldError) HandlerResponse
- type MovieHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerResponse ¶
type HandlerResponse struct { Service string Function string StatusCode int Payload interface{} Err error FieldErrors []common.FieldError }
HandlerResponse structure.
func Created ¶
func Created(payload interface{}) HandlerResponse
Created builds and returns a handler response for a successful create operation.
func InternalServerError ¶
func InternalServerError(serviceName, functionName string, err error) HandlerResponse
InternalServerError builds and returns a handler response for an internal error.
func NoContent ¶
func NoContent() HandlerResponse
NoContent builds and returns a handler response for a successful operation with no content returned.
func NotFound ¶
func NotFound(serviceName, functionName string, err error) HandlerResponse
NotFound builds and returns a handler response for a resource not found error.
func Ok ¶
func Ok(payload interface{}) HandlerResponse
Ok builds and returns a handler response for a successful operation.
func UnprocessableEntity ¶
func UnprocessableEntity(serviceName, functionName string, fieldErrors []common.FieldError) HandlerResponse
UnprocessableEntity builds and returns a handler response for a model with invalid state.
type MovieHandler ¶
type MovieHandler interface { // GetAllMovies returns a handler response containing all found movies // and any additional information. GetAllMovies() HandlerResponse // GetMovieById returns a handler response containing the movie found for a given id // and any additional information. GetMovieById(id int) HandlerResponse // CreateMovie creates a movie and returns a handler response containing the created movie // and any additional information. CreateMovie(newMovie *models.Movie) HandlerResponse // UpdateMovie updates a movie and returns a handler response containing the updated movie // and any additional information. UpdateMovie(id int, movieToUpdate *models.Movie) HandlerResponse // DeleteMovieById deletes a movie for a given id and returns a handler response containing // the results of the operation. DeleteMovieById(id int) HandlerResponse }
MovieHandler contract.
func MovieHandlerImpl ¶
func MovieHandlerImpl(r repositories.MovieRepository) MovieHandler
MovieHandlerImpl builds and returns a movie handler implementation.
Click to show internal directories.
Click to hide internal directories.