Documentation ¶
Index ¶
- Constants
- type ErrorItem
- type Option
- type ResponseDto
- func (r *ResponseDto) File() error
- func (r *ResponseDto) JSON() error
- func (r *ResponseDto) SetData(data interface{})
- func (r *ResponseDto) SetError(key int, msg string) *ResponseDto
- func (r *ResponseDto) SetFile(name string, data []byte)
- func (r *ResponseDto) SetHeaders(headers map[string]string)
- func (r *ResponseDto) SetMessage(text string)
- func (r *ResponseDto) SetStatus(status int)
- type ResponseOptions
Constants ¶
View Source
const ( OkStatus = "ok" FailStatus = "fail" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v1.2.1
type Option func(o *ResponseOptions)
func WithContext ¶ added in v1.2.1
func WithContext(ctx fiber.Ctx) Option
func WithOldContext ¶ added in v1.2.1
type ResponseDto ¶
type ResponseDto struct { ResponseOptions Status string `json:"status"` Message string `json:"message"` Errors []ErrorItem `json:"errors"` Data []interface{} `json:"data"` TmRequest string `json:"tm_req"` TmRequestSt time.Time `json:"-"` // contains filtered or unexported fields }
ResponseDto generic response DTO
func NewResp ¶ added in v1.2.1
func NewResp(opts ...Option) *ResponseDto
NewResp wrap context (compatible both for v2 and v3)
func NewResponse ¶
func NewResponse(ctx fiber.Ctx) *ResponseDto
NewResponse wrap context (compatible only with fiber v3)
func (*ResponseDto) File ¶ added in v1.4.0
func (r *ResponseDto) File() error
File finalize response and convert to file
func (*ResponseDto) JSON ¶
func (r *ResponseDto) JSON() error
JSON finalize response and convert to Json
func (*ResponseDto) SetError ¶
func (r *ResponseDto) SetError(key int, msg string) *ResponseDto
SetError set key/msg error
func (*ResponseDto) SetFile ¶ added in v1.4.0
func (r *ResponseDto) SetFile(name string, data []byte)
SetFile name and data
func (*ResponseDto) SetHeaders ¶
func (r *ResponseDto) SetHeaders(headers map[string]string)
SetHeaders response headers
func (*ResponseDto) SetMessage ¶
func (r *ResponseDto) SetMessage(text string)
SetMessage response message
func (*ResponseDto) SetStatus ¶
func (r *ResponseDto) SetStatus(status int)
SetStatus response status
type ResponseOptions ¶ added in v1.2.1
type ResponseOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.