Documentation ¶
Index ¶
- Constants
- func GetRawURL(url string, params gin.Params) string
- func ResponseError(body interface{}, c *gin.Context, message *exception.ErrorException)
- func ResponseOk(body interface{}, c *gin.Context, ressMessage *ResponseInfo)
- func SpaceMap(str string) string
- func ValidateRequest(req interface{}) *exception.ErrorException
- type BodyLogWriter
- type LogRequest
- type MessageHelper
- type ResponseInfo
Constants ¶
View Source
const ( RESPONSE_CREATED_SUCCESS = "RESPONSE_CREATED_SUCCESS" RESPONSE_SUCCESS_UPDATED = "RESPONSE_SUCCESS_UPDATED" RESPONSE_SUCCESS = "RESPONSE_SUCCESS" )
* const that defined with key on configuration json/messages.json
Variables ¶
This section is empty.
Functions ¶
func GetRawURL ¶
* create raw URL from current URL binding with gin.Params and replacing with the key
func ResponseError ¶
func ResponseError(body interface{}, c *gin.Context, message *exception.ErrorException)
generate response error with return ErrorException model
func ResponseOk ¶
func ResponseOk(body interface{}, c *gin.Context, ressMessage *ResponseInfo)
generate response ok with custom http code
func ValidateRequest ¶
func ValidateRequest(req interface{}) *exception.ErrorException
* validating Object struct with govalidator rule
Types ¶
type BodyLogWriter ¶
type BodyLogWriter struct { gin.ResponseWriter Body *bytes.Buffer }
type LogRequest ¶
type LogRequest struct { RequestId string `json:"request_id"` Header interface{} `json:"header"` Method string `json:"method"` Url string `json:"url"` Body interface{} `json:"body"` HttpCode int `json:"http_code"` Latency time.Duration `json:"latency"` ResponseBody interface{} `json:"response_body"` }
type MessageHelper ¶
type MessageHelper interface {
Ress(message string) *ResponseInfo
}
type ResponseInfo ¶
type ResponseInfo struct {
Info configuration.MessageModel
}
func NewSuccess ¶
func NewSuccess(successMessage string) *ResponseInfo
* creating new success object and return it interface
func (ResponseInfo) Ress ¶
func (ResponseInfo) Ress() *ResponseInfo
* throwing message that defined with the const that exist on key json/messages.json and add some additional information from go
Source Files ¶
Click to show internal directories.
Click to hide internal directories.