validator

package
v0.0.0-...-a6a4234 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

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

Validator is an object that wraps jsval.JSVal, and can be used to validate an object against a schema

func New

func New(s *schema.Schema) *Validator

New creates a new Validator from a JSON Schema

func (*Validator) Compile

func (v *Validator) Compile() (*jsval.JSVal, error)

Compile takes the underlying schema and compiles the validator from it. You usually should NOT use this method (the main reason this is exposed is for benchmarking), as it is automatically called when `Validate` is called.

func (*Validator) Validate

func (v *Validator) Validate(x interface{}) error

Validate takes an arbitrary piece of data and validates it against the schema.

Jump to

Keyboard shortcuts

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