Documentation ¶
Index ¶
- Constants
- func DefaultHttpErrorOverrideFunc(err *mrerr.AppError) (int, *mrerr.AppError)
- func HandlerGetHealth() func(w http.ResponseWriter, r *http.Request)
- func HandlerGetStatusOKAsJson() func(w http.ResponseWriter, r *http.Request)
- func HandlerGetStructAsJson(data any, status int) (func(w http.ResponseWriter, r *http.Request), error)
- func PrepareAppToStart(ctx context.Context) (execute func() error, interrupt func(error))
- type CacheableResponseWriter
- type ErrorResponseSender
- type FileResponseSender
- type HttpController
- type HttpErrorOverrideFunc
- type HttpHandler
- type HttpHandlerAdapterFunc
- type HttpHandlerFunc
- type HttpMiddleware
- type HttpMiddlewareFunc
- type HttpRouter
- type ListenOptions
- type RequestDecoder
- type RequestParserBool
- type RequestParserDateTime
- type RequestParserFile
- type RequestParserImage
- type RequestParserInt64
- type RequestParserItemStatus
- type RequestParserKeyInt32
- type RequestParserListPager
- type RequestParserListSorter
- type RequestParserParamFunc
- type RequestParserString
- type RequestParserUUID
- type RequestParserValidate
- type ResponseEncoder
- type ResponseSender
- type ServerAdapter
- type ServerOptions
- type StatResponseWriter
Constants ¶
View Source
const ( ListenTypeSock = "sock" ListenTypePort = "port" )
Variables ¶
This section is empty.
Functions ¶
func DefaultHttpErrorOverrideFunc ¶ added in v0.10.0
DefaultHttpErrorOverrideFunc - only for: 401, 403, 404, 418, 5XX
func HandlerGetHealth ¶ added in v0.9.6
func HandlerGetHealth() func(w http.ResponseWriter, r *http.Request)
func HandlerGetStatusOKAsJson ¶ added in v0.9.6
func HandlerGetStatusOKAsJson() func(w http.ResponseWriter, r *http.Request)
func HandlerGetStructAsJson ¶ added in v0.9.6
Types ¶
type CacheableResponseWriter ¶ added in v0.14.0
type CacheableResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func NewCacheableResponseWriter ¶ added in v0.14.0
func NewCacheableResponseWriter(w http.ResponseWriter) *CacheableResponseWriter
func (*CacheableResponseWriter) Body ¶ added in v0.14.0
func (w *CacheableResponseWriter) Body() []byte
func (*CacheableResponseWriter) StatusCode ¶ added in v0.14.0
func (w *CacheableResponseWriter) StatusCode() int
func (*CacheableResponseWriter) Write ¶ added in v0.14.0
func (w *CacheableResponseWriter) Write(buf []byte) (int, error)
func (*CacheableResponseWriter) WriteHeader ¶ added in v0.14.0
func (w *CacheableResponseWriter) WriteHeader(statusCode int)
type ErrorResponseSender ¶ added in v0.10.0
type ErrorResponseSender interface {
SendError(w http.ResponseWriter, r *http.Request, err error)
}
type FileResponseSender ¶ added in v0.10.0
type FileResponseSender interface { ResponseSender SendFile(ctx context.Context, w http.ResponseWriter, file mrtype.File) error SendAttachmentFile(ctx context.Context, w http.ResponseWriter, file mrtype.File) error }
type HttpController ¶ added in v0.10.0
type HttpController interface {
Handlers() []HttpHandler
}
type HttpErrorOverrideFunc ¶ added in v0.10.0
type HttpHandler ¶ added in v0.10.0
type HttpHandler struct { Method string URL string Permission string Func HttpHandlerFunc }
type HttpHandlerAdapterFunc ¶ added in v0.10.0
type HttpHandlerAdapterFunc func(next HttpHandlerFunc) http.HandlerFunc
func NewMiddlewareHttpHandlerAdapter ¶ added in v0.13.0
func NewMiddlewareHttpHandlerAdapter(s ErrorResponseSender) (HttpHandlerAdapterFunc, error)
type HttpHandlerFunc ¶ added in v0.10.0
type HttpHandlerFunc func(w http.ResponseWriter, r *http.Request) error
func MiddlewareCheckAccess ¶ added in v0.10.0
func MiddlewareCheckAccess( section mrperms.AppSection, access mrperms.AccessControl, permission string, next HttpHandlerFunc, ) HttpHandlerFunc
func MiddlewareIdempotency ¶ added in v0.14.0
func MiddlewareIdempotency(provider mridempotency.Provider, sender ResponseSender, next HttpHandlerFunc) HttpHandlerFunc
type HttpMiddleware ¶ added in v0.10.0
func MiddlewareGeneral ¶ added in v0.13.0
func MiddlewareGeneral(tr *mrlang.Translator) HttpMiddleware
type HttpMiddlewareFunc ¶ added in v0.10.0
func (HttpMiddlewareFunc) Middleware ¶ added in v0.10.0
func (f HttpMiddlewareFunc) Middleware(next http.Handler) http.Handler
type HttpRouter ¶ added in v0.10.0
type HttpRouter interface { RegisterMiddleware(handlers ...HttpMiddleware) Register(controllers ...HttpController) HandlerFunc(method, path string, handler http.HandlerFunc) HttpHandlerFunc(method, path string, handler HttpHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) }
type ListenOptions ¶
type RequestDecoder ¶ added in v0.10.0
type RequestParserBool ¶ added in v0.12.0
type RequestParserDateTime ¶ added in v0.12.0
type RequestParserFile ¶ added in v0.12.0
type RequestParserImage ¶ added in v0.12.0
type RequestParserInt64 ¶ added in v0.12.0
type RequestParserItemStatus ¶ added in v0.10.0
type RequestParserItemStatus interface {
FilterStatusList(r *http.Request, key string) []mrenum.ItemStatus
}
type RequestParserKeyInt32 ¶ added in v0.10.0
type RequestParserListPager ¶ added in v0.14.0
type RequestParserListPager interface {
PageParams(r *http.Request) mrtype.PageParams
}
type RequestParserListSorter ¶ added in v0.14.0
type RequestParserListSorter interface {
SortParams(r *http.Request, sorter mrview.ListSorter) mrtype.SortParams
}
type RequestParserParamFunc ¶ added in v0.12.0
type RequestParserString ¶ added in v0.12.0
type RequestParserUUID ¶ added in v0.10.0
type RequestParserValidate ¶ added in v0.10.0
type ResponseEncoder ¶ added in v0.10.0
type ResponseSender ¶ added in v0.10.0
type ResponseSender interface { Send(w http.ResponseWriter, status int, structure any) error SendBytes(w http.ResponseWriter, status int, body []byte) error SendNoContent(w http.ResponseWriter) error }
type ServerAdapter ¶ added in v0.5.1
type ServerAdapter struct {
// contains filtered or unexported fields
}
func NewServerAdapter ¶ added in v0.13.0
func NewServerAdapter(ctx context.Context, opts ServerOptions) *ServerAdapter
func (*ServerAdapter) PrepareToStart ¶ added in v0.13.0
func (s *ServerAdapter) PrepareToStart(ctx context.Context) (execute func() error, interrupt func(error))
type ServerOptions ¶
type StatResponseWriter ¶ added in v0.13.0
type StatResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func NewStatResponseWriter ¶ added in v0.13.0
func NewStatResponseWriter(ctx context.Context, w http.ResponseWriter) *StatResponseWriter
func (*StatResponseWriter) Write ¶ added in v0.13.0
func (w *StatResponseWriter) Write(buf []byte) (int, error)
func (*StatResponseWriter) WriteHeader ¶ added in v0.13.0
func (w *StatResponseWriter) WriteHeader(statusCode int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.