Documentation ¶
Index ¶
- Variables
- func BadRequest(ctx *fasthttp.RequestCtx, errResp error)
- func InternalServerError(ctx *fasthttp.RequestCtx)
- func NotFound(ctx *fasthttp.RequestCtx)
- func ParsePagination(ctx *fasthttp.RequestCtx) (*pagination_interface.Pagination, error)
- func Success(ctx *fasthttp.RequestCtx, result interface{})
- func SuccessWithPagination(ctx *fasthttp.RequestCtx, result interface{}, ...)
- type Middleware
- type PagedResponse
- type PaginationOffsetResponse
- type QueryArgs
- type Response
- type Server
- func (server *Server) DELETE(path string, handler fasthttp.RequestHandler) *Server
- func (server *Server) GET(path string, handler fasthttp.RequestHandler) *Server
- func (server *Server) ListenAndServe() error
- func (server *Server) PATCH(path string, handler fasthttp.RequestHandler) *Server
- func (server *Server) POST(path string, handler fasthttp.RequestHandler) *Server
- func (server *Server) PUT(path string, handler fasthttp.RequestHandler) *Server
- func (server *Server) Use(middleware Middleware) *Server
- func (server *Server) WithCors(options cors.Options) *Server
- func (server *Server) WithLogger(logger applogger.Logger) *Server
- func (server *Server) WithPanicHandler(handler func(ctx *fasthttp.RequestCtx, err interface{})) *Server
- func (server *Server) WithPprof(path string) *Server
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BadRequest ¶
func BadRequest(ctx *fasthttp.RequestCtx, errResp error)
func InternalServerError ¶
func InternalServerError(ctx *fasthttp.RequestCtx)
func NotFound ¶
func NotFound(ctx *fasthttp.RequestCtx)
func ParsePagination ¶
func ParsePagination(ctx *fasthttp.RequestCtx) (*pagination_interface.Pagination, error)
func Success ¶
func Success(ctx *fasthttp.RequestCtx, result interface{})
func SuccessWithPagination ¶
func SuccessWithPagination( ctx *fasthttp.RequestCtx, result interface{}, paginationResult *pagination_interface.PaginationResult, )
Types ¶
type Middleware ¶
type Middleware = func(fasthttp.RequestHandler) fasthttp.RequestHandler
type PagedResponse ¶
type PagedResponse struct { Response OffsetPagination *PaginationOffsetResponse `json:"pagination,omitempty"` }
type PaginationOffsetResponse ¶
type PaginationOffsetResponse struct { TotalRecord int64 `json:"total_record"` TotalPage int64 `json:"total_page"` CurrentPage int64 `json:"current_page"` Limit int64 `json:"limit"` }
func OptPaginationOffsetResponseFromResult ¶
func OptPaginationOffsetResponseFromResult( offsetResult *pagination_interface.PaginationOffsetResult, ) *PaginationOffsetResponse
type QueryArgs ¶
QueryArgs is a helper on top of fasthttp.QueryArgs
func NewQueryArgs ¶
type Response ¶
type Response struct { Result interface{} `json:"result"` Err string `json:"error,omitempty"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) DELETE ¶
func (server *Server) DELETE(path string, handler fasthttp.RequestHandler) *Server
func (*Server) GET ¶
func (server *Server) GET(path string, handler fasthttp.RequestHandler) *Server
func (*Server) ListenAndServe ¶
func (*Server) PATCH ¶
func (server *Server) PATCH(path string, handler fasthttp.RequestHandler) *Server
func (*Server) POST ¶
func (server *Server) POST(path string, handler fasthttp.RequestHandler) *Server
func (*Server) PUT ¶
func (server *Server) PUT(path string, handler fasthttp.RequestHandler) *Server
func (*Server) Use ¶
func (server *Server) Use(middleware Middleware) *Server
func (*Server) WithPanicHandler ¶
func (server *Server) WithPanicHandler(handler func(ctx *fasthttp.RequestCtx, err interface{})) *Server
Click to show internal directories.
Click to hide internal directories.