response

package
v1.3.0-rc.0...-12c9840 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package response release api 响应格式

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, statusCode int, code errcode.ImageErrorCode, errorMsg string)

Error release api 失败时响应

func Success

func Success(w http.ResponseWriter, data interface{})

Success release api 成功时响应

Types

type ErrorMsg

type ErrorMsg struct {
	Code    string      `json:"code,omitempty"`
	Msg     string      `json:"msg,omitempty"`
	Context interface{} `json:"ctx,omitempty"`
}

ErrorMsg release api 错误消息格式

type Response

type Response struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data,omitempty"`
	Err     ErrorMsg    `json:"err,omitempty"`
}

Response 内部约定的Resposne格式, 更多,请参考: https://yuque.antfin-inc.com/terminus_paas_dev/paas/fozwef

Jump to

Keyboard shortcuts

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