neterrific

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: MIT Imports: 6 Imported by: 0

README

neterrific

A simple collection http renderers and utilities for go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest = errors.New("invalid request body")
)

Functions

func ParseAndValidate

func ParseAndValidate(r *http.Request, v any) error

func ParseBody

func ParseBody(r *http.Request, v any) error

func SendHTTPJSONError

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

func SendJSON

func SendJSON(w http.ResponseWriter, status int, p any)

func SendValidationError

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

func Validator

func Validator() *validator.Validate

Types

type Payload

type Payload map[string]any

type ValidationError

type ValidationError struct {
	Errors []string
}

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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