Documentation
¶
Index ¶
- func FormatErrorMessage(field string, err validator.FieldError) string
- func GenerateUniqueNumber(length int) string
- func GetCurrentTime() time.Time
- func GetJSONFieldMap(obj interface{}) map[string]string
- func JsonResponse(w http.ResponseWriter, statusCode int, data interface{})
- func ResponseValidation(w http.ResponseWriter, statusCode int, errors interface{}) error
- func ReturnResponse(w http.ResponseWriter, statusCode int, message string, data interface{})
- func Slugify(s string) string
- func ValidationResponse(w http.ResponseWriter, statusCode int, error interface{}, obj interface{})
- func WriteJSONEValidation(w http.ResponseWriter, statusCode int, error interface{})
- func WriteJSONError(w http.ResponseWriter, statusCode int, message string)
- func WriteJSONResponse(w http.ResponseWriter, statusCode int, data interface{})
- type CustomDateFormat
- type ErrorResponse
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatErrorMessage ¶ added in v1.3.8
func FormatErrorMessage(field string, err validator.FieldError) string
func GenerateUniqueNumber ¶
func GetCurrentTime ¶
func GetJSONFieldMap ¶ added in v1.3.8
GetJSONFieldMap uses reflection to map struct fields to their JSON tags
func JsonResponse ¶
func JsonResponse(w http.ResponseWriter, statusCode int, data interface{})
func ResponseValidation ¶
func ResponseValidation(w http.ResponseWriter, statusCode int, errors interface{}) error
func ReturnResponse ¶
func ReturnResponse(w http.ResponseWriter, statusCode int, message string, data interface{})
func ValidationResponse ¶ added in v1.3.8
func ValidationResponse(w http.ResponseWriter, statusCode int, error interface{}, obj interface{})
WriteJSONEValidation dynamically gets JSON tag fields and writes a validation error response
func WriteJSONEValidation ¶
func WriteJSONEValidation(w http.ResponseWriter, statusCode int, error interface{})
func WriteJSONError ¶
func WriteJSONError(w http.ResponseWriter, statusCode int, message string)
WriteJSONError writes a JSON error response with the specified status code and message.
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, statusCode int, data interface{})
WriteJSONResponse writes a JSON response with the specified status code.
Types ¶
type CustomDateFormat ¶
func (CustomDateFormat) MarshalJSON ¶
func (c CustomDateFormat) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface
type ErrorResponse ¶
Click to show internal directories.
Click to hide internal directories.