Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response[T any] struct { ErrorDetails perrors.Err `json:"errorDetails"` Error bool `json:"error"` Message string `json:"message"` Data T `json:"data"` Status int `json:"status"` // contains filtered or unexported fields }
func (*Response[T]) WithStatus ¶
WithStatus will set the HTTP response status code.
This is not a preferred way of setting status code.
- Try to use perrors.Err embedded with a status code whenever possible.
- Default is http.StatusOK and it need not be set explicitly.
func (*Response[T]) Write ¶
func (r *Response[T]) Write(ctx *fasthttp.RequestCtx)
Write will set the `content-type` to `application/json` and write the response to the fasthttp context.
Click to show internal directories.
Click to hide internal directories.