web

package
v0.0.0-...-55af573 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalServer = errors.New("Something went wrong, we are aware of the problem")
	ErrValidation     = errors.New("Validation error")
)

Functions

func Decode

func Decode(r *http.Request, val interface{}) error

func Message

func Message(k string, v interface{}) interface{}

func NewRequestError

func NewRequestError(err error, status int) error

func Respond

func Respond(w http.ResponseWriter, data interface{}, statusCode int) error

func RespondError

func RespondError(w http.ResponseWriter, err error)

Types

type RequestError

type RequestError struct {
	Err    error
	Status int
	Fields []string
}

func (*RequestError) Error

func (re *RequestError) Error() string

type Validation

type Validation struct {
	Message string   `json:"message"`
	Errors  []string `json:"errors"`
}

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator() *Validator

Jump to

Keyboard shortcuts

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