helpers

package
v0.0.0-...-2e4e4b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJson

func ReadJson(r *http.Request, data any)

func ValidateVar

func ValidateVar(field interface{}, paramName string, tag string)

func WriteJson

func WriteJson(w http.ResponseWriter, data any, status int)

func WriteJsonError

func WriteJsonError(w http.ResponseWriter, err error, status int)

Types

type ServerError

type ServerError struct {
	Message string
	Status  int
}

func NewServerError

func NewServerError(message string, status int) *ServerError

func (*ServerError) ErrorMessage

func (s *ServerError) ErrorMessage() any

type ValidationFieldError

type ValidationFieldError struct {
	Param   string
	Message string
}

func (*ValidationFieldError) ErrorMessage

func (v *ValidationFieldError) ErrorMessage() any

type ValidationFieldErrors

type ValidationFieldErrors []ValidationFieldError

func (*ValidationFieldErrors) ErrorMessage

func (v *ValidationFieldErrors) ErrorMessage() any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL