Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Success success response Success = &Response{Code: 2000, Message: "success"} // PermissionDenied permission denied response PermissionDenied = &Response{Code: 4003, Message: "permission denied"} // NotFound not found response NotFound = &Response{Code: 4004, Message: "not found"} // ManyRequest many request response ManyRequest = &Response{Code: 4429, Message: "too many requests"} // Failed failed response Failed = &Response{Code: 5000, Message: "failed"} // AuthFail auth fail response AuthFail = &Response{Code: 4001, Message: "auth failed"} )
Functions ¶
Types ¶
type Response ¶
type Response struct { Code int `json:"code"` // the status code is the status code agreed with the front end and app, not the HTTP status code Data interface{} `json:"data"` // return data Message string `json:"message"` // customize the returned message content // contains filtered or unexported fields }
Response HTTP return the data structure. You can use this or customize it
func NewResponse ¶
NewResponse response
code custom status code agreed by server, client and Web data specific return data message can not be transmitted, custom message
Click to show internal directories.
Click to hide internal directories.