Discover Packages
github.com/BentCoder/golibrary
pkg
response
package
Version:
v0.0.17
Opens a new window with list of versions in this module.
Published: Jun 6, 2020
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Write sends the response to the client. The `Response` fields can be
overridden by passing variadic `opts` ("Functional Options") arguments. If
no options are given, an empty `200` response is used.
Option helps overriding/adding response options to the current response.
Error represents "failure" response.
func Success(action string , data interface{}, meta interface{}) Option
Success represents "successful" response.
type Response struct {
Action string `json:"action,omitempty"`
Data interface{} `json:"data,omitempty"`
Meta interface{} `json:"meta,omitempty"`
Message string `json:"message,omitempty"`
Errors map[string ]string `json:"errors,omitempty"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.