validation

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidChoice = errors.New("invalid choice")

ErrInvalidChoice indicates that the provided flag argument is not among the valid choices.

Functions

func Bind

func Bind(value reflect.Value, field reflect.StructField, choices []string, opt scan.Opts) func(val string) error

Bind builds a validation function including all validation routines (builtin or user-defined) available.

Types

type ValueValidator

type ValueValidator interface {
	// IsValidValue returns an error if the provided string value is valid for
	// the flag.
	IsValidValue(value string) error
}

ValueValidator is the interface implemented by types that can validate a flag argument themselves. The provided value is directly passed from the command line. This interface has been retroported from jessevdk/go-flags.

Jump to

Keyboard shortcuts

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