Documentation ¶
Index ¶
- Variables
- func BindForm[REQ any](req *http.Request, obj *REQ) error
- func BindHeader[REQ any](req *http.Request, obj *REQ) error
- func BindJson[REQ any](req *http.Request, obj *REQ) error
- func BindPostForm[REQ any](req *http.Request, obj *REQ) error
- func BindQuery[REQ any](req *http.Request, obj *REQ) error
- func Body(r *http.Request, w http.ResponseWriter, thenFunc NoReqNoRespService)
- func BodyReq[REQ any](r *http.Request, w http.ResponseWriter, req REQ, ...)
- func BodyReqResp[REQ, RESP any](r *http.Request, w http.ResponseWriter, req REQ, ...)
- func BodyResp[RESP any](r *http.Request, w http.ResponseWriter, thenFunc NoReqRespService[RESP])
- func Form(r *http.Request, w http.ResponseWriter, thenFunc NoReqNoRespService)
- func FormReq[REQ any](r *http.Request, w http.ResponseWriter, req REQ, ...)
- func FormReqResp[REQ, RESP any](r *http.Request, w http.ResponseWriter, req REQ, ...)
- func FormResp[RESP any](r *http.Request, w http.ResponseWriter, thenFunc NoReqRespService[RESP])
- func MapFormWithTag(ptr any, form map[string][]string, tag string) error
- func Query(r *http.Request, w http.ResponseWriter, thenFunc NoReqNoRespService)
- func QueryReq[REQ any](r *http.Request, w http.ResponseWriter, req REQ, ...)
- func QueryReqResp[REQ, RESP any](r *http.Request, w http.ResponseWriter, req REQ, ...)
- func QueryResp[RESP any](r *http.Request, w http.ResponseWriter, thenFunc NoReqRespService[RESP])
- func StringToBytes(s string) []byte
- func WriteBindError(w http.ResponseWriter, err error)
- func WriteJson[RESP any](w http.ResponseWriter, httpCode int, resp RESP, err error)
- func WriteServiceError(w http.ResponseWriter, err error)
- func WriteSuccessJSON(w http.ResponseWriter, data any)
- type BindFunc
- type CheckFun
- type NoReqNoRespService
- type NoReqRespService
- type PageReq
- type PageResp
- type ReqNoRespService
- type ServiceFunc
- type ValidFunc
- type WriteFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrConvertMapStringSlice can not convert to map[string][]string ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings") // ErrConvertToMapString can not convert to map[string]string ErrConvertToMapString = errors.New("can not convert to map of strings") )
View Source
var ( HtmlContentType = []string{"text/html; charset=utf-8"} JsonContentType = []string{"application/json; charset=utf-8"} )
Functions ¶
func Body ¶
func Body(r *http.Request, w http.ResponseWriter, thenFunc NoReqNoRespService)
func BodyReq ¶
func BodyReq[REQ any](r *http.Request, w http.ResponseWriter, req REQ, thenFunc ReqNoRespService[REQ])
func BodyReqResp ¶
func BodyReqResp[REQ, RESP any](r *http.Request, w http.ResponseWriter, req REQ, thenFunc ServiceFunc[REQ, RESP])
func BodyResp ¶
func BodyResp[RESP any](r *http.Request, w http.ResponseWriter, thenFunc NoReqRespService[RESP])
func Form ¶
func Form(r *http.Request, w http.ResponseWriter, thenFunc NoReqNoRespService)
func FormReq ¶
func FormReq[REQ any](r *http.Request, w http.ResponseWriter, req REQ, thenFunc ReqNoRespService[REQ])
func FormReqResp ¶
func FormReqResp[REQ, RESP any](r *http.Request, w http.ResponseWriter, req REQ, thenFunc ServiceFunc[REQ, RESP])
func FormResp ¶
func FormResp[RESP any](r *http.Request, w http.ResponseWriter, thenFunc NoReqRespService[RESP])
func Query ¶
func Query(r *http.Request, w http.ResponseWriter, thenFunc NoReqNoRespService)
func QueryReq ¶
func QueryReq[REQ any](r *http.Request, w http.ResponseWriter, req REQ, thenFunc ReqNoRespService[REQ])
func QueryReqResp ¶
func QueryReqResp[REQ, RESP any](r *http.Request, w http.ResponseWriter, req REQ, thenFunc ServiceFunc[REQ, RESP])
func QueryResp ¶
func QueryResp[RESP any](r *http.Request, w http.ResponseWriter, thenFunc NoReqRespService[RESP])
func StringToBytes ¶
func WriteBindError ¶
func WriteBindError(w http.ResponseWriter, err error)
func WriteJson ¶
func WriteJson[RESP any](w http.ResponseWriter, httpCode int, resp RESP, err error)
func WriteServiceError ¶
func WriteServiceError(w http.ResponseWriter, err error)
func WriteSuccessJSON ¶
func WriteSuccessJSON(w http.ResponseWriter, data any)
Types ¶
type NoReqNoRespService ¶
type NoReqNoRespService func() error
type NoReqRespService ¶
type ReqNoRespService ¶
Click to show internal directories.
Click to hide internal directories.