Documentation ¶
Index ¶
- Variables
- func ApiError(bc *beegoContext.Context, errMsg string)
- func CheckRule(rule Rule) error
- func GetParamRequireError(key string) error
- type APIDataResponse
- type APIResponse
- func (r *APIResponse) Error(ret int, msg string) *APIResponse
- func (r *APIResponse) Fail(code int, msg string) *APIResponse
- func (r *APIResponse) SetData(data *APIDataResponse) *APIResponse
- func (r *APIResponse) SetMsg(msg string) *APIResponse
- func (r *APIResponse) SetRet(ret int) *APIResponse
- func (r *APIResponse) Success(data interface{}) *APIResponse
- type Formatter
- type Rule
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ValidTypeInt = "int" ValidTypeBool = "bool" ValidTypeFloat = "float" ValidTypeMap = "map" ValidTypeString = "string" ValidTypeStrings = "strings" )
View Source
var ( IntFormatter intFormatter BoolFormatter boolFormatter FloatFormatter floatFormatter StringFormatter stringFormatter )
Functions ¶
func ApiError ¶
func ApiError(bc *beegoContext.Context, errMsg string)
func GetParamRequireError ¶
Types ¶
type APIDataResponse ¶
type APIDataResponse struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
接口返回的data部分数据
func NewAPIDataResponse ¶
func NewAPIDataResponse() *APIDataResponse
func (*APIDataResponse) Init ¶
func (a *APIDataResponse) Init() *APIDataResponse
func (*APIDataResponse) SetCode ¶
func (a *APIDataResponse) SetCode(code int) *APIDataResponse
func (*APIDataResponse) SetData ¶
func (a *APIDataResponse) SetData(data interface{}) *APIDataResponse
func (*APIDataResponse) SetMsg ¶
func (a *APIDataResponse) SetMsg(msg string) *APIDataResponse
type APIResponse ¶
type APIResponse struct { Ret int `json:"ret"` Msg string `json:"msg"` Data *APIDataResponse `json:"data"` }
顶层接口返回
func (*APIResponse) SetData ¶
func (r *APIResponse) SetData(data *APIDataResponse) *APIResponse
设置返回的具体业务数据
func (*APIResponse) Success ¶
func (r *APIResponse) Success(data interface{}) *APIResponse
快捷接口,业务成功返回
Click to show internal directories.
Click to hide internal directories.