validation

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePayload

func ValidatePayload(p *Payload) error

ValidatePayload is 1 implementation of the closure in our controller

Types

type Controller

type Controller struct {
	ValidatePayload func(p *Payload) error
}

Controller holds our validation functions

func New

func New() *Controller

New initializes a controller with our local validation, it can be overwritten

func (*Controller) Process

func (c *Controller) Process(w http.ResponseWriter, r *http.Request)

Process is a handler that validates a post payload

type Payload

type Payload struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

Payload is the value we process

type Verror

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

Verror is an error that occurs during validation, we can return this to a user

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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