Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReponseOption ¶
type ReponseOption func(resp *Response)
func Error ¶
func Error(err *apperror.Error) ReponseOption
func Message ¶
func Message(msg string) ReponseOption
func Meta ¶
func Meta(meta any, keyValues ...map[string]any) ReponseOption
return as data in format
Case: Map | Struct
{ code:0, message:"OK" meta:{ key:value } }
Case: Slices
{ code:0, message:"OK" meta:{ list:[] [key]:value } }
func Status ¶
func Status(status int) ReponseOption
Ovewrite default status
Status(http.StatusCreated)
type Response ¶
type Response struct { Code int `json:"code"` Message string `json:"message"` // The Data field contains the actual response data Data any `json:"data,omitempty"` // Meta provides additional information about the data, such as its type or kind.y. Meta any `json:"meta,omitempty"` // contains filtered or unexported fields }
func New ¶
func New(opts ...ReponseOption) *Response
Click to show internal directories.
Click to hide internal directories.