internal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginsWith

func BeginsWith(s string, testStr []string) bool

beginsWith returns true if s begins with any of the strings in the provided slice

func ContainsAny

func ContainsAny(str string, substrings []string) bool

ContainsAny checks if str contains any of the substrings

func CreateDirIfNotExists

func CreateDirIfNotExists(path string)

CreateDirIfNotExists will create a directory at path if it doesn't exist using os.MkdirAll

func IsAbsoluteURL

func IsAbsoluteURL(href string) bool

isAbsoluteURL checks if href is absolute URL

e.g.

<http|https>://google.com/query -> true

/query -> false

func IsValidScheme

func IsValidScheme(scheme string) bool

isValidScheme tells if the scheme is valid

func PermittedValue added in v0.9.0

func PermittedValue[T comparable](value T, permitterValues ...T) bool

func PrefixString added in v0.9.0

func PrefixString(s []string, prefix string) []string

PrefixString returns []string with every element of s prefixed with prefix

func ValuePresent

func ValuePresent(needle string, haystack []string) bool

ValuePresent checks if needle is present in haystack

Types

type Validator

type Validator struct {
	Errors map[string]string
}

func NewValidator

func NewValidator() *Validator

func (*Validator) AddError

func (v *Validator) AddError(key, message string)

func (*Validator) Check

func (v *Validator) Check(ok bool, key, message string)

func (*Validator) Valid

func (v *Validator) Valid() bool

Jump to

Keyboard shortcuts

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