Version: v0.1.10 Latest Latest

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

Go to latest
Published: Apr 13, 2018 License: Apache-2.0 Imports: 7 Imported by: 0




This section is empty.


This section is empty.


func IsCIDR

func IsCIDR(i interface{}, others map[string]interface{}) error

func IsFilepath

func IsFilepath(i interface{}, others map[string]interface{}) error

func IsIP

func IsIP(i interface{}, others map[string]interface{}) (err error)

func IsInEnumIgnoreCase

func IsInEnumIgnoreCase(items ...string) validatorFunc

func List

func List(r Rule) (required []string, optionals []string, suggested []string)

func MaxLengthOf

func MaxLengthOf(l int) validatorFunc

func MinLengthOf

func MinLengthOf(l int) validatorFunc

func Run

func Run(r Rule, input []string) error

func SpecBuilder

func SpecBuilder(r Rule, vs ...Validators) *specBuilder

func Suggested

func Suggested(s ...string) (sugs []suggested)

func Validate

func Validate(all Validators, paramValues map[string]interface{}) error


type Reducer

type Reducer interface {
	Keys() []string
	Reduce(map[string]interface{}) (map[string]interface{}, error)

type Rule

type Rule interface {
	Run(input []string) error
	Required() []string
	Missing(input []string) []string
	String() string

func AllOf

func AllOf(rules ...Rule) Rule

func AtLeastOneOf

func AtLeastOneOf(rules ...Rule) Rule

func Key

func Key(k string) Rule

func None

func None() Rule

func OnlyOneOf

func OnlyOneOf(rules ...Rule) Rule

func Opt

func Opt(i ...interface{}) Rule

type Spec

type Spec interface {
	Rule() Rule
	Reducers() []Reducer
	Validators() Validators

func NewSpec

func NewSpec(r Rule, vs ...Validators) Spec

type Validators

type Validators map[string]validatorFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL