Documentation ¶
Index ¶
- func BadRequest(w http.ResponseWriter, message string)
- func DoRawResponse(w http.ResponseWriter, status int, data interface{}, headers map[string]string)
- func Error(w http.ResponseWriter, err error)
- func NotFound(w http.ResponseWriter, message string)
- func OK(w http.ResponseWriter, data interface{})
- func ServerError(w http.ResponseWriter, err error)
- type Named
- type Page
- type PageFilterFunc
- type PageSortFunc
- type Response
- type SortAndSearchAble
- type StatusError
- type TypedFilterFun
- type TypedPage
- type TypedSortFun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, message string)
func DoRawResponse ¶
func DoRawResponse(w http.ResponseWriter, status int, data interface{}, headers map[string]string)
func Error ¶
func Error(w http.ResponseWriter, err error)
func NotFound ¶
func NotFound(w http.ResponseWriter, message string)
func OK ¶
func OK(w http.ResponseWriter, data interface{})
func ServerError ¶
func ServerError(w http.ResponseWriter, err error)
Types ¶
type Page ¶
type Page struct { List interface{} `json:"list"` Total int64 `json:"total"` Page int64 `json:"page,omitempty"` Size int64 `json:"size,omitempty"` }
func NewPageData ¶
func NewPageData(list interface{}, page, size int, filterfn PageFilterFunc, sortfn PageSortFunc) Page
type PageFilterFunc ¶
type PageSortFunc ¶
type Response ¶
type Response struct { Message string `json:"message,omitempty"` Data interface{} `json:"data,omitempty"` Error interface{} `json:"error,omitempty"` }
type SortAndSearchAble ¶
type StatusError ¶
func NewError ¶
func NewError(status int, message string) *StatusError
func (StatusError) Error ¶
func (e StatusError) Error() string
type TypedFilterFun ¶
type TypedPage ¶
type TypedPage[T any] struct { Total int64 List []T // TODO: add lowercase fields tag here CurrentPage int64 CurrentSize int64 }
func NewTypedPage ¶
type TypedSortFun ¶
Click to show internal directories.
Click to hide internal directories.