Documentation ¶
Overview ¶
Package generator defines GeneratorInterface interface and implements some random value generators.
Index ¶
Constants ¶
const ( Alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" Numerals = "0123456789" ASCII = Alphabet + Numerals + "~!@#$%^&*()-_+={}[]\\|<,>.?/\"';:`" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExpressionValueGenerator ¶
type ExpressionValueGenerator struct {
// contains filtered or unexported fields
}
ExpressionValueGenerator implements Generator interface. It generates random string based on the input expression. The input expression is a string, which may contain "[a-zA-Z0-9]{length}" constructs, defining range and length of the result random characters.
Examples:
from | value ----------------------------- "test[0-9]{1}x" | "test7x" "[0-1]{8}" | "01001100" "0x[A-F0-9]{4}" | "0xB3AF" "[a-zA-Z0-9]{8}" | "hW4yQU5i"
TODO: Support more regexp constructs.
func NewExpressionValueGenerator ¶
func NewExpressionValueGenerator(seed *rand.Rand) ExpressionValueGenerator
NewExpressionValueGenerator creates new ExpressionValueGenerator.
func (ExpressionValueGenerator) GenerateValue ¶
func (g ExpressionValueGenerator) GenerateValue(expression string) (interface{}, error)
GenerateValue generates random string based on the input expression. The input expression is a pseudo-regex formatted string. See ExpressionValueGenerator for more details.