Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ResponseOK = BaseResponse(200, "ok") // 通用成功 ResponseErr = BaseResponse(500, "err") // 通用错误 ResponseNeedLogin = BaseResponse(401, "need login") // 没有权限 )
View Source
var DateLayoutShort string = "20060102"
View Source
var TimeLayout string = "2006-01-02 15:04:05"
View Source
var TimeLayoutShort string = "2006-01-02"
Functions ¶
This section is empty.
Types ¶
type DateTime ¶ added in v1.3.1
func (DateTime) MarshalJSON ¶ added in v1.3.1
func (*DateTime) UnmarshalJSON ¶ added in v1.3.1
type PageResponseModel ¶ added in v1.4.1
type ResponseModel ¶
type ResponseModel[T any] struct { Code int `json:"code"` Msg string `json:"msg"` Data T `json:"data"` ServerTime int64 `json:"serverTime"` }
func BaseResponse ¶
func BaseResponse(code int, msg string) *ResponseModel[interface{}]
func (*ResponseModel[T]) WithData ¶
func (res *ResponseModel[T]) WithData(data T) ResponseModel[T]
追加响应数据
func (*ResponseModel[T]) WithMsg ¶
func (res *ResponseModel[T]) WithMsg(message string) ResponseModel[T]
Click to show internal directories.
Click to hide internal directories.