validator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasInt

func HasInt(s string) bool

func IsIPRange

func IsIPRange(ip string) bool

func IsIPv4Address

func IsIPv4Address(ip string) bool

func IsIPv4AddressWithMask

func IsIPv4AddressWithMask(data string) bool

} else if validator.IsIPv4AddressWithMask(s) || validator.IsIPv6AddressWithMask(s) {

func IsIPv6Address

func IsIPv6Address(ip string) bool

func IsIPv6AddressWithMask

func IsIPv6AddressWithMask(data string) bool

func IsInt

func IsInt(s string) bool

Types

type Ipv4Validator

type Ipv4Validator struct{}

func (Ipv4Validator) Validate

func (v Ipv4Validator) Validate(data map[string]interface{}) Result

type Ipv6Validator

type Ipv6Validator struct{}

func (Ipv6Validator) Validate

func (v Ipv6Validator) Validate(data map[string]interface{}) Result

type Result

type Result interface {
	Status() bool
	Msg() string
	AddError(Result)
}

func NewValidateResult

func NewValidateResult(status bool, msg string) Result

type ValidateChain

type ValidateChain struct {
	Chain []Validator
	// contains filtered or unexported fields
}

func NewValidateChain

func NewValidateChain() *ValidateChain

func (*ValidateChain) Add

func (vc *ValidateChain) Add(validator Validator)

func (*ValidateChain) StopOnError

func (vc *ValidateChain) StopOnError() *ValidateChain

func (*ValidateChain) Validate

func (vc *ValidateChain) Validate(data map[string]interface{}) Result

type Validator

type Validator interface {
	Validate(data map[string]interface{}) Result
}

Jump to

Keyboard shortcuts

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