Documentation ¶
Index ¶
- func CommResToSpecial(in interface{}, out interface{}) error
- func DeleteRequest(ctx context.Context, returnValuePointer interface{}, baseUrl string, ...) error
- func GetRequest(ctx context.Context, returnValuePointer interface{}, baseUrl string, ...) error
- func PostRequest(ctx context.Context, returnValuePointer interface{}, url string, ...) error
- func PutRequest(ctx context.Context, returnValuePointer interface{}, url string, ...) error
- func RenderFail(ctx context.Context, err error, w http.ResponseWriter, lc logger.LoggingClient)
- func RenderFailNoLog(ctx context.Context, err error, w http.ResponseWriter)
- func RenderRpcFail(err error, lc logger.LoggingClient) error
- func Result(code uint32, data interface{}, msg string, w http.ResponseWriter, ...)
- func ResultExcelData(c *gin.Context, fileName string, data *bytes.Buffer)
- func ResultNoLog(code uint32, data interface{}, msg string, w http.ResponseWriter)
- func ResultSuccess(data interface{}, w http.ResponseWriter, lc logger.LoggingClient)
- func ResultSuccessNoLog(data interface{}, w http.ResponseWriter)
- func ResultZipFile(c *gin.Context, lc logger.LoggingClient, fileName string, file *os.File)
- type CommonResponse
- func NewFailCommonResponse(err error) CommonResponse
- func NewFailWithI18nResponse(ctx context.Context, err error) CommonResponse
- func NewSuccessCommonResponse(data interface{}) CommonResponse
- func WsResult(code uint32, data interface{}, errMsg string, successMsg string) CommonResponse
- func WsResultFail(code uint32, msg string) CommonResponse
- type ResPageResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommResToSpecial ¶
func CommResToSpecial(in interface{}, out interface{}) error
func DeleteRequest ¶
func DeleteRequest(ctx context.Context, returnValuePointer interface{}, baseUrl string, requestPath string, params url.Values) error
Helper method to make the delete request and return the body
func GetRequest ¶
func GetRequest(ctx context.Context, returnValuePointer interface{}, baseUrl string, requestPath string, requestParams url.Values) error
Helper method to make the get request and return the body
func PostRequest ¶
func PostRequest( ctx context.Context, returnValuePointer interface{}, url string, data interface{}) error
Helper method to make the post JSON request and return the body
func PutRequest ¶
func RenderFail ¶
func RenderFail(ctx context.Context, err error, w http.ResponseWriter, lc logger.LoggingClient)
func RenderFailNoLog ¶
func RenderFailNoLog(ctx context.Context, err error, w http.ResponseWriter)
func RenderRpcFail ¶
func RenderRpcFail(err error, lc logger.LoggingClient) error
func Result ¶
func Result(code uint32, data interface{}, msg string, w http.ResponseWriter, lc logger.LoggingClient)
func ResultNoLog ¶
func ResultNoLog(code uint32, data interface{}, msg string, w http.ResponseWriter)
func ResultSuccess ¶
func ResultSuccess(data interface{}, w http.ResponseWriter, lc logger.LoggingClient)
func ResultSuccessNoLog ¶
func ResultSuccessNoLog(data interface{}, w http.ResponseWriter)
func ResultZipFile ¶
Types ¶
type CommonResponse ¶
type CommonResponse struct { Success bool `json:"success"` // 接口是否成功 ErrorCode uint32 `json:"errorCode"` // 错误码 ErrorMsg string `json:"errorMsg,omitempty"` // 错误信息 SuccessMsg string `json:"successMsg,omitempty"` // 成功信息 Result interface{} `json:"result" swaggertype:"object"` // 返回结果 }
func NewFailWithI18nResponse ¶
func NewFailWithI18nResponse(ctx context.Context, err error) CommonResponse
func NewSuccessCommonResponse ¶
func NewSuccessCommonResponse(data interface{}) CommonResponse
func WsResult ¶
func WsResult(code uint32, data interface{}, errMsg string, successMsg string) CommonResponse
func WsResultFail ¶
func WsResultFail(code uint32, msg string) CommonResponse
func (CommonResponse) Error ¶
func (r CommonResponse) Error() error
type ResPageResult ¶
type ResPageResult struct { List interface{} `json:"list"` Total uint32 `json:"total"` Page int `json:"page"` PageSize int `json:"pageSize"` }
func NewPageResult ¶
func NewPageResult(responses interface{}, total uint32, page int, pageSize int) ResPageResult
Click to show internal directories.
Click to hide internal directories.