helpers

package
v0.0.0-...-4471eec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocationHeaderKey = "Location"
)

Variables

This section is empty.

Functions

func JSONError

func JSONError(ctx *gin.Context, statusCode int, err error)

func JSONErrorCode

func JSONErrorCode(ctx *gin.Context, statusCode int, code int, err error)

func JSONErrorCodef

func JSONErrorCodef(ctx *gin.Context, statusCode int, code int, format string, a ...interface{})

func JSONErrorf

func JSONErrorf(ctx *gin.Context, statusCode int, format string, a ...interface{})

func JSONForbidden

func JSONForbidden(ctx *gin.Context, format string, a ...interface{})

func JSONForbiddenCode

func JSONForbiddenCode(ctx *gin.Context, code int, format string, a ...interface{})

func JSONResponse

func JSONResponse(ctx *gin.Context, statusCode int, obj ...interface{})

func JSONResponseBadRequest

func JSONResponseBadRequest(ctx *gin.Context, obj ...interface{})

func JSONResponseCollection

func JSONResponseCollection(ctx *gin.Context, obj interface{})

func JSONResponseInternalServerError

func JSONResponseInternalServerError(ctx *gin.Context, obj ...interface{})

func JSONResponseNotImplemented

func JSONResponseNotImplemented(ctx *gin.Context)

func JSONResponseOK

func JSONResponseOK(ctx *gin.Context, obj ...interface{})

func JSONResponseObject

func JSONResponseObject(ctx *gin.Context, obj interface{})

func JSONResponseValidationFailed

func JSONResponseValidationFailed(ctx *gin.Context, err error)

Types

type ResponseError

type ResponseError struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"error,omitempty"`
}

func NewResponseError

func NewResponseError(code int, message string) *ResponseError

func (*ResponseError) Error

func (r *ResponseError) Error() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL