util

package module
v0.0.0-...-09a0c22 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: GPL-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// All represents the string instruction set that contains
	// all alpha-numeric characters.
	All set = [2]int{0, 62}
	// Upper represents the string instruction set that contains
	// only uppercase non-numeric characters.
	Upper set = [2]int{26, 52}
	// Lower represents the string instruction set that contains
	// only lowercase non-numeric characters.
	Lower set = [2]int{0, 26}
	// Number represents the string instruction set that contains
	// only numeric characters.
	Number set = [2]int{52, 62}
	// Characters represents the string instruction set that contains
	// mixed case non-numeric characters.
	Characters set = [2]int{0, 52}

	// Rand is the generic Random number generator, based
	// on a time seed.
	Rand = &random{Rand: rand.New(rand.NewSource(time.Now().UnixNano()))}
)

Functions

func Must

func Must(v interface{}, err error) interface{}

Must accepts dual paramater returns with an error on the end. This function returns the resulting object if the error returned in nil. This function will panic if the error is not nil.

Types

type Matcher

type Matcher string

Matcher is an alias of a string that can contain specific variable instructsions to be replaced when calling the 'String' function. This alias provides the 'Match' function, which returns a Regexp struct that will match any value generated.

func (Matcher) Match

func (s Matcher) Match() Regexp

Match returns a valid Regexp struct that is guaranteed to match any string generated by the Matcher's 'String' function.

func (Matcher) MatchEx

func (s Matcher) MatchEx(o bool) Regexp

MatchEx returns a valid Regexp struct that is guaranteed to match any string generated by the Matcher's 'String' function. MatchEx returns an inverse matcher if the bool is false

func (Matcher) String

func (s Matcher) String() string

String parses this MatchString value and will preform any replacements and fill any variables contained.

func (Matcher) UnMatch

func (s Matcher) UnMatch() Regexp

UnMatch returns a valid Regexp struct that is guaranteed to not match any string generated by the Matcher's 'String' function.

type Regexp

type Regexp interface {
	String() string
	Match([]byte) bool
	MatchString(string) bool
}

Regexp is a compatibility interface that is used to allow for UnMatch values to be used lacking the ability of RE2 used in Golang to do negative lookahead.

type String

type String string

String is a wrapper for strings to support the fmt.Stringer interface.

func (String) String

func (s String) String() string

String returns the string value of itself.

Jump to

Keyboard shortcuts

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