name

package
v0.0.0-...-e25bc3e Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package 'name' contains contracts and functionality to help with naming things.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	FormatName(name string) (string, error)
}

Formatter is an interface which defines operations for types which can format names.

FormatName takes a name, formats it and then returns the result.

type Processor

type Processor interface {
	Validator
	Formatter
}

Processor is a Validator and Formatter.

type RuneLevelProcessor

type RuneLevelProcessor interface {
	RuneLevelValidator
	Formatter
}

RuneLevelProcessor is a RuneLevelValidator and Formatter.

type RuneLevelValidator

type RuneLevelValidator interface {
	Validator
	IsRuneValid(r rune) bool
}

RuneLevelValidator is Validator which can also validate isolated runes within a name.

IsRuneValid returns true if the provided rune is a valid component of a name

func NewBasicValidator

func NewBasicValidator(isEmptyValid bool, isValidRuneCheck func(rune) bool) (RuneLevelValidator, error)

NewBasicValidator constructs a RuneLevelValidator which can validate names for being empty or containing isolated runes which fail a basic validation check

type Validator

type Validator interface {
	IsValid(name string) bool
}

Validator is an interface which declares operations associated with name validation.

IsValid returns true if the provided name is valid.

func NewLengthValidator

func NewLengthValidator(min uint, max uint) Validator

NewLengthValidator constructs a Validator which can verify that names are of a correct length

func NewRegexpValidator

func NewRegexpValidator(validPattern string) (Validator, error)

NewRegexpValidator constructs a new Validator which verifies that a name matches a specific regular expression

Jump to

Keyboard shortcuts

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