Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseResponse ¶
type ErrorResponse ¶
type ReqCtx ¶
type ReqCtx interface {
Request() *fasthttp.Request
ReadJson(any) error
Body() []byte
SetUserValue(key any, value any)
UserValue(key any) any
Telemetry() context.Context
AuthToken() string
SetContentType(string)
SetStatusCode(int)
Error(msg string, statusCode int)
Write([]byte) (int, error)
WriteString(string) (int, error)
WriteJson(any) error
WriteResponse(*Response) error
NewResponse(statusCode int, status, code string, data any) *Response
WriteSuccessResponse(data any)
WriteErrorResponse(err error, data any)
}
type ReqHandler ¶
type ReqHandler func(ReqCtx)
type ResponseConfig ¶
type ResponseConfig struct {
Success SuccessResponse
Err ErrorResponse
}
type Server ¶
type Server interface {
SetReadTimeout(time.Duration) Server
SetIdleTimeout(time.Duration) Server
SetMaxRequestBodySize(int) Server
SetServerName(string) Server
DisableLogo(bool) Server
AddRoute(method, path string, handler func(request ReqCtx), middlewares ...func(handler ReqHandler) ReqHandler) Server
UseState(state.State) Server
UseCors(Cors) Server
UseLogger(logger.Logger) Server
UseTelemetry(telemetry.Telemetry) Server
UseSwagger() Server
UseProfiling() Server
SetListener(net.Listener)
GetListener() net.Listener
Listen(hostname string, port int) <-chan error
ListenTLS(hostname string, port int, certFile, keyFile string) <-chan error
Serve(hostname string, port int, exit chan error) <-chan error
ServeTLS(hostname string, port int, exit chan error, certFile, keyFile string) <-chan error
Shutdown() error
RegisterService(service, hostname string, port int) error
DeregisterService() error
}
type SuccessResponse ¶
Click to show internal directories.
Click to hide internal directories.