Documentation
¶
Index ¶
- func Handle[T any](config *HandlerConfig, handlers ...HandlerFunc[T]) http.HandlerFunc
- func WithHandlerConfigSerializer(serializer serialization.ISerializer) func(*HandlerConfig)
- func WithHandlerMaxMemSize(size int64) func(*HandlerConfig)
- type HandlerConfig
- type HandlerFunc
- type HttpCtx
- func (h *HttpCtx[T]) Abort()
- func (h *HttpCtx[T]) AbortWithResponse(statusCode int, body any)
- func (h *HttpCtx[T]) AddHeader(name string, value string)
- func (h *HttpCtx[T]) Context() context.Context
- func (h *HttpCtx[T]) DelHeader(name string)
- func (h *HttpCtx[T]) Error(err error)
- func (h *HttpCtx[T]) Errors() []error
- func (h *HttpCtx[T]) GetBody() (T, error)
- func (h *HttpCtx[T]) GetFiles() map[string][]*multipart.FileHeader
- func (h *HttpCtx[T]) GetHeader(name string) []string
- func (h *HttpCtx[T]) GetQueryParam(name string) string
- func (h *HttpCtx[T]) GetRawRequest() *http.Request
- func (h *HttpCtx[T]) GetRawResponseWriter() http.ResponseWriter
- func (h *HttpCtx[T]) GetResponseBody() any
- func (h *HttpCtx[T]) GetStatusCode() int
- func (h *HttpCtx[T]) GetUrlParam(name string) string
- func (h *HttpCtx[T]) SetHeader(name string, value string)
- func (h *HttpCtx[T]) SetResponseBody(value any)
- func (h *HttpCtx[T]) SetStatusCode(code int)
- func (h *HttpCtx[T]) Stream(step func() (ServerSentEvent, bool)) (bool, error)
- type ServerSentEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
func Handle[T any](config *HandlerConfig, handlers ...HandlerFunc[T]) http.HandlerFunc
func WithHandlerConfigSerializer ¶
func WithHandlerConfigSerializer(serializer serialization.ISerializer) func(*HandlerConfig)
func WithHandlerMaxMemSize ¶
func WithHandlerMaxMemSize(size int64) func(*HandlerConfig)
Types ¶
type HandlerConfig ¶
type HandlerConfig struct {
// contains filtered or unexported fields
}
func NewHandlerConfig ¶
func NewHandlerConfig(opts ...func(*HandlerConfig)) *HandlerConfig
type HandlerFunc ¶
type HttpCtx ¶
type HttpCtx[T any] struct { // contains filtered or unexported fields }
func NewHttpCtx ¶
func NewHttpCtx[T any](req *http.Request, responseWriter http.ResponseWriter, serializer serialization.ISerializer, maxMemSize int64) *HttpCtx[T]
func (*HttpCtx[T]) AbortWithResponse ¶ added in v0.3.3
func (*HttpCtx[T]) GetQueryParam ¶
func (*HttpCtx[T]) GetRawRequest ¶ added in v0.3.6
func (*HttpCtx[T]) GetRawResponseWriter ¶ added in v0.3.6
func (h *HttpCtx[T]) GetRawResponseWriter() http.ResponseWriter
func (*HttpCtx[T]) GetResponseBody ¶
func (*HttpCtx[T]) GetStatusCode ¶
func (*HttpCtx[T]) GetUrlParam ¶
func (*HttpCtx[T]) SetResponseBody ¶
func (*HttpCtx[T]) SetStatusCode ¶
type ServerSentEvent ¶
Click to show internal directories.
Click to hide internal directories.