package
0.0.0-20210321144845-716047f9604a
Repository: https://github.com/phaesoo/shield.git
Documentation: pkg.go.dev

# Functions

Assert makes an assertion about a Response, with optional status, message, and code checks.
AssertError confirms that the response was an error.
AssertFail confirms that the response is a failure.
AssertOK confirms that the response was successful.
BadRequest.
Error responds with 501 and the provided code and error message status code >= 500.
ExtractData extracts the `data` payload inside of the JSON response.
Fail responds with the given status code and the provided code and message.
Get extracts a `resp.Resp` shaped response payload from a `http.Response`.
InvalidRequest is used to notify that the request is invalid and cannot be handled.
NewError creates a new error response with the given code and optional message.
NewFail creates a failure JSON response with the given data, code, and optional message.
NewSuccess creates a successful JSON response with the given data and optional message.
OK is wrapper func for Success with status code 200.
Success responds with status 200 and the provided data and message status code >= 200 < 400.
Unauthorized is used when the user does not have a valid token.
UnknownResource is used when the URL is valid, but the requested resource could not be found.
UnprocessableError is used to return error with 422 HTTP status code.
ValidationError is used to notify that the request's parameters/body/form-data contained invalid data.
WriteJSON writes out the given data to the `http.ResponseWriter`, along with required headers.

# Constants

General code.
General code.
General code.
Business error code.
General code.
General code.
General code.
General code.
Business error code.
Status.
Status.
Status.

# Structs

Resp is the standard response format.

# Type aliases

Code type.
Status type.