Documentation ¶
Index ¶
- func HTTPException(httpCode int, detail string, headers ...map[string]string)
- type API
- func (a *API) AddMiddleware(middlewares ...Middleware)
- func (a *API) HTTPExceptionHandler(f func(httpCode int, detail string) Response)
- func (a *API) IncludeRouter(router any, prefix string, isDocs bool, middlewares ...Middleware)
- func (a *API) Run(addr ...string) error
- func (a *API) SetLang(lang Lang)
- func (a *API) SetResponseMediaType(mediaTypes ...MediaType)
- type APP
- type ApiKey
- type Context
- type HTTPBasic
- type HTTPBearer
- type HTTPResponse
- type HandleFunc
- type Lang
- type MediaType
- type Middleware
- type Response
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct { OpenAPIInfo *openapi.Info OpenAPIServers []*openapi.Server OpenAPITags []*openapi.Tag // contains filtered or unexported fields }
func (*API) AddMiddleware ¶
func (a *API) AddMiddleware(middlewares ...Middleware)
func (*API) HTTPExceptionHandler ¶
func (*API) IncludeRouter ¶
func (a *API) IncludeRouter(router any, prefix string, isDocs bool, middlewares ...Middleware)
func (*API) SetResponseMediaType ¶
type APP ¶
type APP interface { Init() GET(path string, callback func(req *http.Request, writer http.ResponseWriter)) POST(path string, callback func(req *http.Request, writer http.ResponseWriter)) PUT(path string, callback func(req *http.Request, writer http.ResponseWriter)) DELETE(path string, callback func(req *http.Request, writer http.ResponseWriter)) OPTIONS(path string, callback func(req *http.Request, writer http.ResponseWriter)) HEAD(path string, callback func(req *http.Request, writer http.ResponseWriter)) PATCH(path string, callback func(req *http.Request, writer http.ResponseWriter)) TRACE(path string, callback func(req *http.Request, writer http.ResponseWriter)) Run(addr ...string) error }
type Context ¶
type HTTPBearer ¶
type HTTPBearer interface {
HTTPBearer(token string)
}
type HTTPResponse ¶
func (*HTTPResponse[T]) Bytes ¶
func (h *HTTPResponse[T]) Bytes() []byte
func (*HTTPResponse[T]) GetBody ¶
func (h *HTTPResponse[T]) GetBody() any
func (*HTTPResponse[T]) GetHeaders ¶
func (h *HTTPResponse[T]) GetHeaders() map[string]string
func (*HTTPResponse[T]) GetHttpCode ¶
func (h *HTTPResponse[T]) GetHttpCode() int
type HandleFunc ¶
type HandleFunc func(ctx *Context)
type Lang ¶
type Lang interface { Required(field string) string Lt(field string, val float64) string Lte(field string, val float64) string Gt(field string, val float64) string Gte(field string, val float64) string MultipleOf(field string, val float64) string Max(field string, val uint64) string Min(field string, val uint64) string Unique(field string) string Regexp(field string, val string) string Enum(field string, val []any) string }
type MediaType ¶
type MediaType string
const JSON MediaType = "application/json"
const XML MediaType = "application/xml"
type Middleware ¶
type Middleware func(ctx *Context)
type Router ¶
type Router struct{}
Router is used to set access routes and routing methods
Tag Description: path: Access Routing method: Access method. Multiple contents separated by ',' summary: A short summary of the API. desc: A description of the API. CommonMark syntax MAY be used for rich text representation. tags: Multiple contents separated by ','
Source Files ¶
Click to show internal directories.
Click to hide internal directories.