Documentation ¶
Index ¶
- Constants
- func DefaultHttpErrorOverrideFunc(err *mrerr.AppError) (int, *mrerr.AppError)
- func HandlerGetHealth() func(w http.ResponseWriter, r *http.Request)
- func HandlerGetServiceInfoAsJson(cfg ConfigServiceInfo) (func(w http.ResponseWriter, r *http.Request), error)
- 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 ConfigServiceInfo
- 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 RequestParserParamFunc
- type RequestParserSortPage
- 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 HandlerGetServiceInfoAsJson ¶ added in v0.9.6
func HandlerGetServiceInfoAsJson(cfg ConfigServiceInfo) (func(w http.ResponseWriter, r *http.Request), error)
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 ConfigServiceInfo ¶ added in v0.9.6
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(w http.ResponseWriter, info mrtype.FileInfo, attachmentName string, file io.Reader) 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
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 RequestParserParamFunc ¶ added in v0.12.0
type RequestParserSortPage ¶ added in v0.10.0
type RequestParserSortPage interface { SortParams(r *http.Request, sorter mrview.ListSorter) mrtype.SortParams PageParams(r *http.Request) mrtype.PageParams }
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 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.