generator

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2015 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package generator defines GeneratorInterface interface and implements some random value generators.

Index

Constants

View Source
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.

type Generator

type Generator interface {
	GenerateValue(expression string) (interface{}, error)
}

Generator is an interface for generating random values from an input expression

Directories

Path Synopsis
Package examples demonstrates possible implementation of some random value generators.
Package examples demonstrates possible implementation of some random value generators.

Jump to

Keyboard shortcuts

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