 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- func HandleNotFound(c *gin.Context)
- func HandleSQLError(err string) error
- func StatusText(code int) string
- func Wrapper(handler HandlerFunc) func(c *gin.Context)
- type APIException
- func AuthError(message string) *APIException
- func DuplicateError(message string) *APIException
- func NoContentError(message string) *APIException
- func NotFoundError(message string) *APIException
- func ParameterError(message string) *APIException
- func ServerError() *APIException
- func SuccessError(message string) *APIException
- func UnknownError(message string) *APIException
 
- type HandlerFunc
- type Response
Constants ¶
      View Source
      
  
const ( SERVER_ERROR = 10000 //系統錯誤 NOT_FOUND = 10001 //找不到頁面 UNKNOWN_ERROR = 10002 //未知的錯誤 PARAMETER_ERROR = 10003 //參數錯誤 AUTH_ERROR = 10004 //驗證錯誤 NO_CONTENT = 10005 //沒有內容 DUPLICATE_ERROR = 10006 //重複資料 SUCCESS = 20000 //運行成功 CREATED = 20001 //建立成功 ACCEPT = 20002 //允許操作 )
Variables ¶
This section is empty.
Functions ¶
func StatusText ¶
func Wrapper ¶
func Wrapper(handler HandlerFunc) func(c *gin.Context)
Wrapper 在 register routing 時加入錯誤 handler
Types ¶
type APIException ¶
type APIException struct {
	Code      int    `json:"-"`
	ErrorCode int    `json:"code"`
	Message   string `json:"message"`
	Request   string `json:"request"`
}
    func (*APIException) Error ¶
func (e *APIException) Error() string
type Response ¶
type Response struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}
    func StatusAccept ¶
func StatusNoContent ¶
 Click to show internal directories. 
   Click to hide internal directories.