{"modulePath":"github.com/apache/answer","version":"v1.7.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package handler\n\n## Functions\n\n```go\nfunc BindAndCheck(ctx *gin.Context, data any) bool\n```\nBindAndCheck bind request and check\n\n```go\nfunc BindAndCheckReturnErr(ctx *gin.Context, data any) (errFields []*validator.FormErrorField)\n```\nBindAndCheckReturnErr bind request and check\n\n```go\nfunc GetEnableShortID(ctx context.Context) bool\n```\nGetEnableShortID get language from header\n\n```go\nfunc GetLangByCtx(ctx context.Context) i18n.Language\n```\nGetLangByCtx get language from header\n\n```go\nfunc HandleResponse(ctx *gin.Context, err error, data any)\n```\nHandleResponse Handle response body\n\n## Types\n\n```go\ntype RespBody struct {\n\t// http code\n\tCode int `json:\"code\"`\n\t// reason key\n\tReason string `json:\"reason\"`\n\t// response message\n\tMessage string `json:\"msg\"`\n\t// response data\n\tData any `json:\"data\"`\n}\n```\nRespBody response body.\n\n```go\nfunc NewRespBody(code int, reason string) *RespBody\n```\nNewRespBody new response body\n\n```go\nfunc NewRespBodyData(code int, reason string, data any) *RespBody\n```\nNewRespBodyData new response body with data\n\n```go\nfunc NewRespBodyFromError(e *errors.Error) *RespBody\n```\nNewRespBodyFromError new response body from error\n\n```go\nfunc (r *RespBody) TrMsg(lang i18n.Language) *RespBody\n```\nTrMsg translate the reason cause as a message\n\n","path":"github.com/apache/answer/internal/base/handler","name":"handler","synopsis":"","isRedistributable":true}
