validations

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag uint8
const (
	FValid         Flag = 1 << iota
	FSyntax        Flag = 1 << iota
	FMXLookup      Flag = 1 << iota
	FMXDomainHasIP Flag = 1 << iota // Flag set when the MX domain is verified to have at least one resolvable IP
	FHostConnect   Flag = 1 << iota
	FValidRCPT     Flag = 1 << iota
	FDisposable    Flag = 1 << iota // Address / Domain is considered a disposable e-mail trap

	// FDomainHasIP is Deprecated: Unclear naming. Prefer FMXDomainHasIP
	FDomainHasIP = FMXDomainHasIP // @deprecated
)

Validation Flags, these flags represent successful validation steps. Depending on how far you want to go, you can classify a validation as valid enough, for your use-case.

func (Flag) AsStringSlice added in v0.0.9

func (f Flag) AsStringSlice() []string

func (*Flag) String added in v0.0.9

func (f *Flag) String() string

type Steps

type Steps uint8

Steps holds the validation steps performed, they do not signify validity

func (Steps) HasBeenValidated

func (s Steps) HasBeenValidated() bool

HasBeenValidated returns true if any validations steps have actually been taken.

func (Steps) HasFlag

func (s Steps) HasFlag(f Flag) bool

HasFlag returns true if the type has the flag (or flags) specified

func (Steps) MergeWithNext

func (s Steps) MergeWithNext(new Steps) Steps

MergeWithNext appends to Steps and returns the result.

func (*Steps) RemoveFlag

func (s *Steps) RemoveFlag(f Flag) Steps

func (*Steps) SetFlag

func (s *Steps) SetFlag(new Flag) Steps

SetFlag defines a flag on the type and returns a copy

func (Steps) String

func (s Steps) String() string

type Validations

type Validations uint8

Validations holds the validation steps performed.

func (Validations) HasFlag

func (v Validations) HasFlag(f Flag) bool

HasFlag returns true if the type has the flag (or flags) specified

func (Validations) IsValid

func (v Validations) IsValid() bool

IsValid returns true if the Validations are considered successful

func (Validations) IsValidationsForValidDomain

func (v Validations) IsValidationsForValidDomain() bool

IsValidationsForValidDomain checks if a mask of validations really marks a domain as valid.

func (*Validations) MarkAsInvalid

func (v *Validations) MarkAsInvalid()

MarkAsInvalid clears the CFValid bit and marks the Validations as invalid

func (*Validations) MarkAsValid

func (v *Validations) MarkAsValid()

MarkAsValid sets the CFValid bit and marks the Validations as valid

func (Validations) MergeWithNext

func (v Validations) MergeWithNext(new Validations) Validations

MergeWithNext appends to Validations are returns the result. If the new validations aren't considered valid, it will mark the new Validations as unsuccessful as well. It's opinionated in that it's part of an incremental validation chain

func (*Validations) RemoveFlag

func (v *Validations) RemoveFlag(f Flag) Validations

RemoveFlag removes a flag and returns a copy

func (*Validations) SetFlag

func (v *Validations) SetFlag(new Flag) Validations

SetFlag defines a flag on the type and returns a copy

func (Validations) String

func (v Validations) String() string

Jump to

Keyboard shortcuts

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