validator

package
v0.0.0-...-394a65f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Valid                Violation = "Valid"
	EmptyLongLink                  = "EmptyLongLink"
	LongLinkNotURL                 = "LongLinkNotURL"
	AliasTooLong                   = "AliasTooLong"
	LongLinkTooLong                = "LongLinkTooLong"
	HasFragmentCharacter           = "HasFragmentCharacter"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomAlias

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

CustomAlias represents format validator for custom alias

func NewCustomAlias

func NewCustomAlias() CustomAlias

NewCustomAlias creates custom alias validator.

func (CustomAlias) IsValid

func (c CustomAlias) IsValid(alias string) (bool, Violation)

IsValid checks whether the given alias has valid format.

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

LongLink represents format validator for original long link

func NewLongLink() LongLink

NewLongLink creates long link validator.

func (LongLink) IsValid

func (l LongLink) IsValid(longLink string) (bool, Violation)

IsValid checks whether the given long link has valid format.

type Validator

type Validator interface {
	IsValid(entry string) (bool, Violation)
}

Validator is a common interface for validators.

type Violation

type Violation string

Violation represents a type of invalid error encountered by the validator.

Jump to

Keyboard shortcuts

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