Documentation ¶
Overview ¶
Package helpers implements commonly used functions (response API)//
Index ¶
- func DirectResponse(w http.ResponseWriter, httpStatus int, data interface{})
- func GenerateToken(user models.User) (t models.TokenResp, err error)
- func Response(w http.ResponseWriter, httpStatus int, data interface{})
- func SetBody(Body map[string]interface{}) (io.Reader, error)
- type APIResponse
- type JSONResponse
- type Page
- type PageReq
- type Pages
- type Paginate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirectResponse ¶
func DirectResponse(w http.ResponseWriter, httpStatus int, data interface{})
DirectResponse is
func GenerateToken ¶
GenerateToken generate token JWT
Types ¶
type JSONResponse ¶
type JSONResponse struct { Code int `json:"code"` Message string `json:"message"` Error string `json:"error"` Data interface{} `json:"data"` }
JSONResponse represent a json response
type Page ¶
type Page struct { CurrentPage int `json:"current_page"` TotalPages int `json:"total_pages"` TotalData int `json:"total_data"` NextPage int `json:"next_page"` PreviousPage int `json:"previous_page"` }
Page data sturct
type Pages ¶
type Pages struct { Page int `json:"page"` PerPage int `json:"per_page"` PageCount int `json:"page_count"` TotalCount int `json:"total_count"` }
Pages data sturct
Click to show internal directories.
Click to hide internal directories.