passport

package
v0.0.0-...-07010e4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DigitCountValidator

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

func NewDigitCountValidator

func NewDigitCountValidator(cnt int) DigitCountValidator

func (DigitCountValidator) IsValid

func (v DigitCountValidator) IsValid(s string) bool

type EyeColorValidator

type EyeColorValidator struct {
}

func NewEyeColorValidator

func NewEyeColorValidator() EyeColorValidator

func (EyeColorValidator) IsValid

func (v EyeColorValidator) IsValid(s string) bool

type HeightValidator

type HeightValidator struct {
}

func NewHeightValidator

func NewHeightValidator() HeightValidator

func (HeightValidator) IsValid

func (v HeightValidator) IsValid(s string) bool

type HexColorValidator

type HexColorValidator struct {
}

func NewHexColorValidator

func NewHexColorValidator() HexColorValidator

func (HexColorValidator) IsValid

func (v HexColorValidator) IsValid(s string) bool

type Key

type Key string
const (
	BirthYear      Key = "byr"
	IssueYear      Key = "iyr"
	ExpirationYear Key = "eyr"
	Height         Key = "hgt"
	HairColor      Key = "hcl"
	EyeColor       Key = "ecl"
	PassportID     Key = "pid"
	CountryID      Key = "cid"
)

func AllKeys

func AllKeys() []Key

func MandatoryKeys

func MandatoryKeys() []Key

func (Key) IsValid

func (k Key) IsValid() bool

func (Key) IsValidValue

func (k Key) IsValidValue(s string) bool

func (Key) Validators

func (k Key) Validators() []ValueValidator

type NumberValidator

type NumberValidator struct {
}

func NewNumberValidator

func NewNumberValidator() NumberValidator

func (NumberValidator) IsValid

func (v NumberValidator) IsValid(s string) bool

type Passport

type Passport map[Key]string

func ParseStrings

func ParseStrings(sl []string) (Passport, error)

func (Passport) IsValid

func (p Passport) IsValid() bool

type RangeValidator

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

func NewRangeValidator

func NewRangeValidator(min, max int64) RangeValidator

func (RangeValidator) IsValid

func (v RangeValidator) IsValid(s string) bool

type ValueValidator

type ValueValidator interface {
	IsValid(s string) bool
}

Jump to

Keyboard shortcuts

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