package
0.9.1
Repository: https://github.com/ftchinese/go-rest.git
Documentation: pkg.go.dev

# Functions

New createa a new instance of Render.
NewAlreadyExists is a convenience func to handle MySQL 1062 error.
NewBadRequest creates a new Response for 400 Bad Request with the specified msg.
NewDBError handles various errors returned from the model layer MySQL duplicate error when inserting into uniquely constraint column; ErrNoRows if it cannot retrieve any rows of the specified criteria; `field` is used to identify which field is causing duplicate error.
NewForbidden creates response for 403.
NewInternalError creates response for internal server error.
NewNotFound creates response 404 Not Found.
NewResponseError creates a new ResponseError instance.
NewTooManyRequests respond to rate limit.
NewUnauthorized create a new instance of Response for 401 Unauthorized response.
NewUnprocessable creates response 422 Unprocessable Entity.
NewVEAlreadyExists creates a ValidationError for MySQL unique key constraint failure.

# Constants

CodeAlreadyExists means another resource has the same value as this field.
CodeInvalid means the formatting of a field is invalid.
CodeMissing means a resource does not exist.
CodeMissingField means a required field on a resource has not been set.

# Structs

Render wraps http.ResponseWrtier and configuration of how to send reponse content.
ResponseError is the response body for http code above 400.
ValidationError tells the field that failed validation.

# Type aliases

InvalidCode is the reason why validation failed.