Documentation
¶
Index ¶
Constants ¶
View Source
const ( // BusinessCodeOK represents the business code for success. BusinessCodeOK = 0 // BusinessMsgOk represents the business message for success. BusinessMsgOk = "ok" )
Variables ¶
This section is empty.
Functions ¶
func JsonBaseResponseCtx ¶
func JsonBaseResponseCtx(ctx context.Context, w http.ResponseWriter, v any)
JsonBaseResponseCtx writes v into w with http.StatusOK.
Types ¶
type BaseResponse ¶
type BaseResponse[T any] struct { // Code represents the business code, not the http xstatus code. Code int ` json:"code" xml:"code"` // Msg represents the business message, if Code = BusinessCodeOK, // and Msg is empty, then the Msg will be set to BusinessMsgOk. Message string `json:"message" xml:"message"` // Data represents the business data. Data T `json:"data,omitempty" xml:"data,omitempty"` }
BaseResponse is the base response struct.
Click to show internal directories.
Click to hide internal directories.