Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func INITIALIZE_VARS_DO_NOT_CALL_INSIDE_INIT ¶
func INITIALIZE_VARS_DO_NOT_CALL_INSIDE_INIT()
INITIALIZE_VARS_DO_NOT_CALL_INSIDE_INIT initializes all the package variables to reflect the backing-variable. This call is optional, but if you do not call it, then you must not attempt to access or set the exported package variables until an exported function or method is called first (the functions and methods automatically call this).
NOTE: This function must not be called from within an init() function.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator produces strings containing random words that conform to a provided pattern.
func New ¶
New returns a Generator that is designed to be used repeatedly for a provided pattern.
The pattern can contain '#' (base-10 digit), 'h'/'H' (hexadecimal digit), 'n'/'N'/'Ñ' (nouns), 'a'/'A'/'Ã' (adjectives), 'v'/'V'/'Ṽ' (verbs) and '*' (any word). '\' can be used to escape the special characters. Upper-case characters generate upper-case words. Tilde characters generate title case words.
Example
`学中文:n-v-a-n` could return "学中文:dog-ran-red-banana"
func (Generator) Error ¶
Error must not be used! It is only defined so that the fmt package can "pretty print" the Generator since the Stringer interface can't be implemented.
NOTE: Do not use Generator as an error.
func (Generator) String ¶
String generates a random string that conforms to the provided pattern.
NOTE: When setting an optional max string length, it should be substantially larger than the theoretical minimum to prevent a potential infinite loop. A context can be supplied as the first argument to provide a deadline. If the deadline is reached, an empty string is returned.