Documentation
¶
Index ¶
Constants ¶
const ReadBufferSize = 8192
Variables ¶
var ErrInternal = errors.New("internal error")
var ErrorHandler = func(c *fiber.Ctx, err error) error { return c.Status(http.StatusInternalServerError).JSON(Response{ Ok: false, Error: &ErrorResponse{ Message: err.Error(), Code: 0, }, }) }
Functions ¶
func NewFiberApp ¶
Types ¶
type ErrorResponse ¶
func (ErrorResponse) MarshalEasyJSON ¶
func (v ErrorResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ErrorResponse) MarshalJSON ¶
func (v ErrorResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ErrorResponse) UnmarshalEasyJSON ¶
func (v *ErrorResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ErrorResponse) UnmarshalJSON ¶
func (v *ErrorResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware contains methods to call before handle request
func NewMiddleware ¶
func NewMiddleware(c ...Chain) *Middleware
NewMiddleware return new natsmiddleware
func (*Middleware) AddChain ¶
func (m *Middleware) AddChain(c Chain)
AddChain add natsmiddleware to execute
func (*Middleware) Merge ¶
func (m *Middleware) Merge(middlewares ...*Middleware)
Merge merge logmiddlewares into current
type Pagination ¶
type Pagination struct {
Total int `json:"total"`
Page int `json:"page"`
Pages int `json:"pages"`
PerPage int `json:"per_page"`
}
func (Pagination) MarshalEasyJSON ¶
func (v Pagination) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Pagination) MarshalJSON ¶
func (v Pagination) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Pagination) UnmarshalEasyJSON ¶
func (v *Pagination) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Pagination) UnmarshalJSON ¶
func (v *Pagination) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Response ¶
type Response struct {
Data interface{} `json:"data,omitempty"`
Error *ErrorResponse `json:"error,omitempty"`
Pagination *Pagination `json:"pagination,omitempty"`
Ok bool `json:"ok"`
}
func GetResponseWithError ¶
func GetSuccessResponse ¶
func GetSuccessResponse(data interface{}) *Response
func GetSuccessResponseList ¶
func (Response) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Response) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Response) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Response) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mock_webserver is a generated GoMock package.
|
Package mock_webserver is a generated GoMock package. |