gofake

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 21 Imported by: 0

README

alt text

Gofakeit Go Report Card Go codecov.io GoDoc license

Random data generator written in go

Buy Me A Coffee

Features

Installation

go get github.com/tinygg/faker

Example

import "github.com/tinygg/faker"

gofakeit.Seed(0)

gofakeit.Name()             // Markus Moen
gofakeit.Email()            // alaynawuckert@kozey.biz
gofakeit.Phone()            // (570)245-7485
gofakeit.BS()               // front-end
gofakeit.BeerName()         // Duvel
gofakeit.Color()            // MediumOrchid
gofakeit.Company()          // Moen, Pagac and Wuckert
gofakeit.CreditCardNumber() // 4287271570245748
gofakeit.HackerPhrase()     // Connecting the array won't do anything, we need to generate the haptic COM driver!
gofakeit.JobTitle()         // Director
gofakeit.CurrencyShort()    // USD
// See full list below

Example Struct

import "github.com/tinygg/faker"

// Create structs with random injected data
type Foo struct {
	Bar      string
	Int      int
	Pointer  *int
	Name     string  `fake:"{firstname}"`   // Any available function all lowercase
	Sentence string  `fake:"{sentence:3}"`  // Can call with parameters
	RandStr  string  `fake:"{randomstring:[hello,world]}"`
	Number   string  `fake:"{number:1,10}"` // Comma separated for multiple values
	Skip     *string `fake:"skip"`          // Set to "skip" to not generate data for
}

type FooBar struct {
	Bars    []string `fake:"{name}"`              // Array of random size (1-10) with fake function applied
	Foos    []Foo    `fakesize:"3"`               // Array of size specified with faked struct
	FooBars []Foo    `fake:"{name}" fakesize:"3"` // Array of size 3 with fake function applied
}

// Pass your struct as a pointer
var f Foo
gofakeit.Struct(&f)
fmt.Println(f.Bar)      // hrukpttuezptneuvunh
fmt.Println(f.Int)      // -7825289004089916589
fmt.Println(*f.Pointer) // -343806609094473732
fmt.Println(f.Name)     // fred
fmt.Println(f.Sentence) // Record river mind.
fmt.Println(f.RandStr)  // world
fmt.Println(f.Number)   // 4
fmt.Println(f.Skip)     // <nil>

var fb FooBar
gofakeit.Struct(&fb)
fmt.Println(fb.Bars)      // [Charlie Senger]
fmt.Println(fb.Foos)      // [{blmfxy -2585154718894894116 0xc000317bc0 Emmy Attitude demand addition. hello 3 <nil>} {cplbf -1722374676852125164 0xc000317cb0 Viva Addition option link. hello 7 <nil>}]

Example Custom Functions

// Simple
AddFuncLookup("friendname", Info{
	Category:    "custom",
	Description: "Random friend name",
	Example:     "bill",
	Output:      "string",
	Call: func(m *map[string][]string, info *Info) (interface{}, error) {
		return RandomString([]string{"bill", "bob", "sally"}), nil
	},
})

// With Params
AddFuncLookup("jumbleword", Info{
	Category:    "jumbleword",
	Description: "Take a word and jumple it up",
	Example:     "loredlowlh",
	Output:      "string",
	Params: []Param{
		{Field: "word", Type: "int", Description: "Word you want to jumble"},
	},
	Call: func(m *map[string][]string, info *Info) (interface{}, error) {
		word, err := info.GetString(m, "word")
		if err != nil {
			return nil, err
		}

		split := strings.Split(word, "")
		ShuffleStrings(split)
		return strings.Join(split, ""), nil
	},
})

type Foo struct {
	FriendName string `fake:"{friendname}"`
	JumbleWord string `fake:"{jumbleword:helloworld}"`
}

var f Foo
Struct(&f)
fmt.Printf("%s", f.FriendName) // bill
fmt.Printf("%s", f.JumbleWord) // loredlowlh

Functions

File
JSON(jo *JSONOptions) []byte
XML(xo *XMLOptions) []byte
Extension() string
MimeType() string
Person
Person() *PersonInfo
Name() string
NamePrefix() string
NameSuffix() string
FirstName() string
LastName() string
Gender() string
SSN() string
Contact() *ContactInfo
Email() string
Phone() string
PhoneFormatted() string
Teams(people []string, teams []string) map[string][]string
Generate
Struct(v interface{})
Map() map[string]interface{}
Generate(value string) string
Auth
Username() string
Password(lower bool, upper bool, numeric bool, special bool, space bool, num int) string
Address
Address() *AddressInfo
City() string
Country() string
CountryAbr() string
State() string
StateAbr() string
Street() string
StreetName() string
StreetNumber() string
StreetPrefix() string
StreetSuffix() string
Zip() string
Latitude() float64
LatitudeInRange(min, max float64) (float64, error)
Longitude() float64
LongitudeInRange(min, max float64) (float64, error)
Game
Gamertag() string
Beer
BeerAlcohol() string
BeerBlg() string
BeerHop() string
BeerIbu() string
BeerMalt() string
BeerName() string
BeerStyle() string
BeerYeast() string
Cars
Vehicle() *VehicleInfo
CarMaker() string
CarModel() string
VehicleType() string
FuelType() string
TransmissionGearType() string
Words
Noun() string
Verb() string
Adverb() string
Preposition() string
Adjective() string
Word() string
Sentence(wordCount int) string
Paragraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
LoremIpsumWord() string
LoremIpsumSentence(wordCount int) string
LoremIpsumParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
Question() string
Quote() string
Phrase() string
Foods
Fruit() string
Vegetable() string
Breakfast() string
Lunch() string
Dinner() string
Snack() string
Dessert() string
Misc
Bool() bool
UUID() string
Colors
Color() string
HexColor() string
RGBColor() []int
SafeColor() string
Internet
URL() string
ImageURL(width int, height int) string
DomainName() string
DomainSuffix() string
IPv4Address() string
IPv6Address() string
StatusCode() string
SimpleStatusCode() int
LogLevel(logType string) string
HTTPMethod() string
UserAgent() string
ChromeUserAgent() string
FirefoxUserAgent() string
OperaUserAgent() string
SafariUserAgent() string
Date/Time
Date() time.Time
DateRange(start, end time.Time) time.Time
NanoSecond() int
Second() int
Minute() int
Hour() int
Month() string
Day() int
WeekDay() string
Year() int
TimeZone() string
TimeZoneAbv() string
TimeZoneFull() string
TimeZoneOffset() float32
TimeZoneRegion() string
Payment
Price(min, max float64) float64
CreditCard() *CreditCardInfo
CreditCardCvv() string
CreditCardExp() string
CreditCardNumber(*CreditCardOptions) string
CreditCardType() string
Currency() *CurrencyInfo
CurrencyLong() string
CurrencyShort() string
AchRouting() string
AchAccount() string
BitcoinAddress() string
BitcoinPrivateKey() string
Company
BS() string
BuzzWord() string
Company() string
CompanySuffix() string
Job() *JobInfo
JobDescriptor() string
JobLevel() string
JobTitle() string
Hacker
HackerAbbreviation() string
HackerAdjective() string
HackerIngverb() string
HackerNoun() string
HackerPhrase() string
HackerVerb() string
Hipster
HipsterWord() string
HipsterSentence(wordCount int) string
HipsterParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
App
AppName() string
AppVersion() string
AppAuthor() string
Animal
PetName() string
Animal() string
AnimalType() string
FarmAnimal() string
Cat() string
Dog() string
Emoji
Emoji() string // 🤣
EmojiDescription() string // winking face
EmojiCategory() string // Smileys & Emotion
EmojiAlias() string // smiley
EmojiTag() string // happy
Languages
Language() string
LanguageAbbreviation() string
ProgrammingLanguage() string
ProgrammingLanguageBest() string
Numbers
Number(min int, max int) int
Int8() int8
Int16() int16
Int32() int32
Int64() int64
Uint8() uint8
Uint16() uint16
Uint32() uint32
Uint64() uint64
Float32() float32
Float32Range(min, max float32) float32
Float64() float64
Float64Range(min, max float64) float64
ShuffleInts(a []int)
RandomInt(i []int) int
String
Digit() string
Letter() string
Lexify(str string) string
Numerify(str string) string
ShuffleStrings(a []string)
RandomString(a []string) string

Documentation

Overview

package gofaker provides a set of functions that generate random data

Example
Seed(11)
fmt.Println("Name:", Name())
fmt.Println("Email:", Email())
fmt.Println("Phone:", Phone())
fmt.Println("Address:", Address().Address)
fmt.Println("BS:", BS())
fmt.Println("Beer Name:", BeerName())
fmt.Println("Color:", Color())
fmt.Println("Company:", Company())
fmt.Println("Credit Card:", CreditCardNumber(nil))
fmt.Println("Hacker Phrase:", HackerPhrase())
fmt.Println("Job Title:", JobTitle())
fmt.Println("Password:", Password(true, true, true, true, false, 32))
currency := Currency()
fmt.Printf("Currency: %s - %s", currency.Short, currency.Long)
Output:

Name: Markus Moen
Email: alaynawuckert@kozey.biz
Phone: 9948995369
Address: 35300 South Roads haven, Hilllville, Montana 30232
BS: e-enable
Beer Name: Weihenstephaner Hefeweissbier
Color: MidnightBlue
Company: Epsilon
Credit Card: 6375991714800889
Hacker Phrase: You can't quantify the application without navigating the bluetooth SMS microchip!
Job Title: Architect
Password: SHylpDU2nf9(,U*RaJKM1cOL47VY.BQw
Currency: KES - Kenya Shilling
Example (Array)
Seed(11)

type Foo struct {
	Bar    string
	Int    int
	Name   string  `fake:"{firstname}"`
	Number string  `fake:"{number:1,10}"`
	Skip   *string `fake:"skip"`
}

type FooMany struct {
	Foos  []Foo    `fakesize:"1"`
	Names []string `fake:"{firstname}" fakesize:"3"`
}

var fm FooMany
Struct(&fm)

fmt.Printf("%v\n", fm.Foos)
fmt.Printf("%v\n", fm.Names)
Output:

[{bRMaRxHki -8576773003117070818 Carole 6 <nil>}]
[Dawn Zachery Amie]
Example (Custom)
Seed(11)

AddFuncLookup("friendname", Info{
	Category:    "custom",
	Description: "Random friend name",
	Example:     "bill",
	Output:      "string",
	Call: func(m *map[string][]string, info *Info) (interface{}, error) {
		return RandomString([]string{"bill", "bob", "sally"}), nil
	},
})

type Foo struct {
	FriendName string `fake:"{friendname}"`
}

var f Foo
Struct(&f)

fmt.Printf("%s", f.FriendName)
Output:

bill
Example (Custom_with_params)
Seed(11)

AddFuncLookup("jumbleword", Info{
	Category:    "jumbleword",
	Description: "Take a word and jumple it up",
	Example:     "loredlowlh",
	Output:      "string",
	Params: []Param{
		{Field: "word", Type: "int", Description: "Word you want to jumble"},
	},
	Call: func(m *map[string][]string, info *Info) (interface{}, error) {
		word, err := info.GetString(m, "word")
		if err != nil {
			return nil, err
		}

		split := strings.Split(word, "")
		ShuffleStrings(split)
		return strings.Join(split, ""), nil
	},
})

type Foo struct {
	JumbleWord string `fake:"{jumbleword:helloworld}"`
}

var f Foo
Struct(&f)

fmt.Printf("%s", f.JumbleWord)
Output:

loredlowlh
Example (Struct)
Seed(11)

type Foo struct {
	Bar     string
	Int     int
	Pointer *int
	Name    string  `fake:"{firstname}"`
	Number  string  `fake:"{number:1,10}"`
	Skip    *string `fake:"skip"`
}

var f Foo
Struct(&f)

fmt.Printf("%s\n", f.Bar)
fmt.Printf("%d\n", f.Int)
fmt.Printf("%d\n", *f.Pointer)
fmt.Printf("%v\n", f.Name)
fmt.Printf("%v\n", f.Number)
fmt.Printf("%v\n", f.Skip)
Output:

bRMaRxHki
-8576773003117070818
-7054675846543980602
Enrique
4
<nil>

Index

Examples

Constants

This section is empty.

Variables

View Source
var FuncLookups map[string]Info

FuncLookups is the primary map array with mapping to all available data

Functions

func AchAccount

func AchAccount() string

AchAccount will generate a 12 digit account number

Example
Seed(11)
fmt.Println(AchAccount())
Output:

413645994899

func AchRouting

func AchRouting() string

AchRouting will generate a 9 digit routing number

Example
Seed(11)
fmt.Println(AchRouting())
Output:

713645994

func AddFuncLookup

func AddFuncLookup(functionName string, info Info)

AddFuncLookup takes a field and adds it to map

func Adjective

func Adjective() string

Adjective will generate a random adjective

Example
Seed(11)
fmt.Println(Adjective())
Output:

genuine

func Adverb

func Adverb() string

Adverb will generate a random adverb

Example
Seed(11)
fmt.Println(Adverb())
Output:

smoothly

func Animal

func Animal() string

Animal will return a random animal

Example
Seed(11)
fmt.Println(Animal())
Output:

elk

func AnimalType

func AnimalType() string

AnimalType will return a random animal type

Example
Seed(11)
fmt.Println(AnimalType())
Output:

amphibians

func AppAuthor

func AppAuthor() string

AppAuthor will generate a random company or person name

Example
Seed(11)
fmt.Println(AppAuthor())
Output:

Qado Energy, Inc.

func AppName

func AppName() string

AppName will generate a random app name

Example
Seed(11)
fmt.Println(AppName())
Output:

Parkrespond

func AppVersion

func AppVersion() string

AppVersion will generate a random app version

Example
Seed(11)
fmt.Println(AppVersion())
Output:

1.12.14

func BS

func BS() string

BS will generate a random company bs string

Example
Seed(11)
fmt.Println(BS())
Output:

front-end

func BeerAlcohol

func BeerAlcohol() string

BeerAlcohol will return a random beer alcohol level between 2.0 and 10.0

Example
Seed(11)
fmt.Println(BeerAlcohol())
Output:

2.7%

func BeerBlg

func BeerBlg() string

BeerBlg will return a random beer blg between 5.0 and 20.0

Example
Seed(11)
fmt.Println(BeerBlg())
Output:

6.4°Blg

func BeerHop

func BeerHop() string

BeerHop will return a random beer hop

Example
Seed(11)
fmt.Println(BeerHop())
Output:

Glacier

func BeerIbu

func BeerIbu() string

BeerIbu will return a random beer ibu value between 10 and 100

Example
Seed(11)
fmt.Println(BeerIbu())
Output:

29 IBU

func BeerMalt

func BeerMalt() string

BeerMalt will return a random beer malt

Example
Seed(11)
fmt.Println(BeerMalt())
Output:

Munich

func BeerName

func BeerName() string

BeerName will return a random beer name

Example
Seed(11)
fmt.Println(BeerName())
Output:

Duvel

func BeerStyle

func BeerStyle() string

BeerStyle will return a random beer style

Example
Seed(11)
fmt.Println(BeerStyle())
Output:

European Amber Lager

func BeerYeast

func BeerYeast() string

BeerYeast will return a random beer yeast

Example
Seed(11)
fmt.Println(BeerYeast())
Output:

1388 - Belgian Strong Ale

func BitcoinAddress

func BitcoinAddress() string

BitcoinAddress will generate a random bitcoin address consisting of numbers, upper and lower characters

Example
Seed(11)
fmt.Println(BitcoinAddress())
Output:

1lWLbxojXq6BqWX7X60VkcDIvYA

func BitcoinPrivateKey

func BitcoinPrivateKey() string

BitcoinPrivateKey will generate a random bitcoin private key consisting of numbers, upper and lower characters

Example
Seed(11)
fmt.Println(BitcoinPrivateKey())
Output:

5vrbXTADWJ6sQBSYd6lLkG97jljNc0X9VPBvbVqsIH9lWOLcoqg

func Bool

func Bool() bool

Bool will generate a random boolean value

Example
Seed(11)
fmt.Println(Bool())
Output:

false

func Breakfast

func Breakfast() string

Breakfast will return a random breakfast name

Example
Seed(11)
fmt.Println(Breakfast())
Output:

Blueberry banana happy face pancakes

func BuzzWord

func BuzzWord() string

BuzzWord will generate a random company buzz word string

Example
Seed(11)
fmt.Println(BuzzWord())
Output:

disintermediate

func CSV

func CSV(co *CSVOptions) ([]byte, error)

CSV generates an object or an array of objects in json format

Example (Array)
Seed(11)

value, err := CSV(&CSVOptions{
	RowCount: 3,
	Fields: []Field{
		{Name: "id", Function: "autoincrement"},
		{Name: "first_name", Function: "firstname"},
		{Name: "last_name", Function: "lastname"},
		{Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}},
	},
})
if err != nil {
	fmt.Println(err)
}

fmt.Println(string(value))
Output:

id,first_name,last_name,password
1,Markus,Moen,Dc0VYXjkWABx
2,Osborne,Hilll,XPJ9OVNbs5lm

func CarFuelType

func CarFuelType() string

CarFuelType will return a random fuel type

Example
Seed(11)
fmt.Println(CarFuelType())
Output:

CNG

func CarMaker

func CarMaker() string

CarMaker will return a random car maker

Example
Seed(11)
fmt.Println(CarMaker())
Output:

Nissan

func CarModel

func CarModel() string

CarModel will return a random car model

Example
Seed(11)
fmt.Println(CarModel())
Output:

Aveo

func CarTransmissionType

func CarTransmissionType() string

CarTransmissionType will return a random transmission type

Example
Seed(11)
fmt.Println(CarTransmissionType())
Output:

Manual

func CarType

func CarType() string

CarType will generate a random car type string

Example
Seed(11)
fmt.Println(CarType())
Output:

Passenger car mini

func Cat

func Cat() string

Cat will return a random cat breed

Example
Seed(11)
fmt.Println(Cat())
Output:

Chausie

func Categories

func Categories() map[string][]string

Categories will return a map string array of available data categories and sub categories

func ChromeUserAgent

func ChromeUserAgent() string

ChromeUserAgent will generate a random chrome browser user agent string

Example
Seed(11)
fmt.Println(ChromeUserAgent())
Output:

Mozilla/5.0 (X11; Linux i686) AppleWebKit/5312 (KHTML, like Gecko) Chrome/39.0.836.0 Mobile Safari/5312

func City

func City() (city string)

City will generate a random city string

Example
Seed(11)
fmt.Println(City())
Output:

Marcelside

func Color

func Color() string

Color will generate a random color string

Example
Seed(11)
fmt.Println(Color())
Output:

MediumOrchid

func Company

func Company() (company string)

Company will generate a random company name string

Example
Seed(11)
fmt.Println(Company())
Output:

ClearHealthCosts

func CompanySuffix

func CompanySuffix() string

CompanySuffix will generate a random company suffix string

Example
Seed(11)
fmt.Println(CompanySuffix())
Output:

Inc

func Country

func Country() string

Country will generate a random country string

Example
Seed(11)
fmt.Println(Country())
Output:

Tajikistan

func CountryAbr

func CountryAbr() string

CountryAbr will generate a random abbreviated country string

Example
Seed(11)
fmt.Println(CountryAbr())
Output:

FI

func CreditCardCvv

func CreditCardCvv() string

CreditCardCvv will generate a random CVV number Its a string because you could have 017 as an exp date

Example
Seed(11)
fmt.Println(CreditCardCvv())
Output:

513

func CreditCardExp

func CreditCardExp() string

CreditCardExp will generate a random credit card expiration date string Exp date will always be a future date

Example
Seed(11)
fmt.Println(CreditCardExp())
Output:

01/22

func CreditCardNumber

func CreditCardNumber(cco *CreditCardOptions) string

CreditCardNumber will generate a random luhn credit card number

Example
Seed(11)
fmt.Println(CreditCardNumber(nil))
fmt.Println(CreditCardNumber(&CreditCardOptions{Types: []string{"visa", "discover"}}))
fmt.Println(CreditCardNumber(&CreditCardOptions{Bins: []string{"4111"}}))
fmt.Println(CreditCardNumber(&CreditCardOptions{Gaps: true}))
Output:

4364599489953690649
6011425914583029
4111020276132178
2131 0889 9822 7212

func CreditCardType

func CreditCardType() string

CreditCardType will generate a random credit card type string

Example
Seed(11)
fmt.Println(CreditCardType())
Output:

Visa

func CurrencyLong

func CurrencyLong() string

CurrencyLong will generate a random long currency name

Example
Seed(11)
fmt.Println(CurrencyLong())
Output:

Iraq Dinar

func CurrencyShort

func CurrencyShort() string

CurrencyShort will generate a random short currency value

Example
Seed(11)
fmt.Println(CurrencyShort())
Output:

IQD

func Date

func Date() time.Time

Date will generate a random time.Time struct

Example
Seed(11)
fmt.Println(Date())
Output:

1977-01-07 04:14:25.685339029 +0000 UTC

func DateRange

func DateRange(start, end time.Time) time.Time

DateRange will generate a random time.Time struct between a start and end date

Example
Seed(11)
fmt.Println(DateRange(time.Unix(0, 484633944473634951), time.Unix(0, 1431318744473668209))) // May 10, 1985 years to May 10, 2015
Output:

2012-02-04 14:10:37.166933216 +0000 UTC

func Day

func Day() int

Day will generate a random day between 1 - 31

Example
Seed(11)
fmt.Println(Day())
Output:

12

func Dessert

func Dessert() string

Dessert will return a random dessert name

Example
Seed(11)
fmt.Println(Dessert())
Output:

French napoleons

func Digit

func Digit() string

Digit will generate a single ASCII digit

Example
Seed(11)
fmt.Println(Digit())
Output:

0

func Dinner

func Dinner() string

Dinner will return a random dinner name

Example
Seed(11)
fmt.Println(Dinner())
Output:

Wild addicting dip

func Dog

func Dog() string

Dog will return a random dog breed

Example
Seed(11)
fmt.Println(Dog())
Output:

Norwich Terrier

func DomainName

func DomainName() string

DomainName will generate a random url domain name

Example
Seed(11)
fmt.Println(DomainName())
Output:

centraltarget.biz

func DomainSuffix

func DomainSuffix() string

DomainSuffix will generate a random domain suffix

Example
Seed(11)
fmt.Println(DomainSuffix())
Output:

org

func Email

func Email() string

Email will generate a random email string

Example
Seed(11)
fmt.Println(Email())
Output:

markusmoen@pagac.net

func Emoji

func Emoji() string

Emoji will return a random fun emoji

Example
Seed(11)
fmt.Println(Emoji())
Output:

🧛

func EmojiAlias

func EmojiAlias() string

EmojiAlias will return a random fun emoji alias

Example
Seed(11)
fmt.Println(EmojiAlias())
Output:

deaf_person

func EmojiCategory

func EmojiCategory() string

EmojiCategory will return a random fun emoji category

Example
Seed(11)
fmt.Println(EmojiCategory())
Output:

Food & Drink

func EmojiDescription

func EmojiDescription() string

EmojiDescription will return a random fun emoji description

Example
Seed(11)
fmt.Println(EmojiDescription())
Output:

confetti ball

func EmojiTag

func EmojiTag() string

EmojiTag will return a random fun emoji tag

Example
Seed(11)
fmt.Println(EmojiTag())
Output:

strong

func FarmAnimal

func FarmAnimal() string

FarmAnimal will return a random animal that usually lives on a farm

Example
Seed(11)
fmt.Println(FarmAnimal())
Output:

Chicken

func FileExtension

func FileExtension() string

FileExtension will generate a random file extension

Example
Seed(11)
fmt.Println(FileExtension())
Output:

nes

func FileMimeType

func FileMimeType() string

FileMimeType will generate a random mime file type

Example
Seed(11)
fmt.Println(FileMimeType())
Output:

application/dsptype

func FirefoxUserAgent

func FirefoxUserAgent() string

FirefoxUserAgent will generate a random firefox broswer user agent string

Example
Seed(11)
fmt.Println(FirefoxUserAgent())
Output:

Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_3 rv:7.0) Gecko/1977-07-01 Firefox/37.0

func FirstName

func FirstName() string

FirstName will generate a random first name

Example
Seed(11)
fmt.Println(FirstName())
Output:

Markus

func Float32

func Float32() float32

Float32 will generate a random float32 value

Example
Seed(11)
fmt.Println(Float32())
Output:

3.1128167e+37

func Float32Range

func Float32Range(min, max float32) float32

Float32Range will generate a random float32 value between min and max

Example
Seed(11)
fmt.Println(Float32Range(0, 9999999))
Output:

914774.6

func Float64

func Float64() float64

Float64 will generate a random float64 value

Example
Seed(11)
fmt.Println(Float64())
Output:

1.644484108270445e+307

func Float64Range

func Float64Range(min, max float64) float64

Float64Range will generate a random float64 value between min and max

Example
Seed(11)
fmt.Println(Float64Range(0, 9999999))
Output:

914774.5585333086

func Fruit

func Fruit() string

Fruit will return a random fruit name

Example
Seed(11)
fmt.Println(Fruit())
Output:

Date

func Gamertag

func Gamertag() string

Gamertag will generate a random video game username

Example
Seed(11)
fmt.Println(Gamertag())
Output:

footinterpret63

func Gender

func Gender() string

Gender will generate a random gender string

Example
Seed(11)
fmt.Println(Gender())
Output:

female

func Generate

func Generate(dataVal string) string

Generate fake information from given string. Replaceable values should be within {}

Functions Ex: {firstname} - billy Ex: {sentence:3} - Record river mind. Ex: {number:1,10} - 4 Ex: {uuid} - 590c1440-9888-45b0-bd51-a817ee07c3f2

Letters/Numbers Ex: ### - 481 - random numbers Ex: ??? - fda - random letters

For a complete list of runnable functions use FuncsLookup

Example
Seed(11)

fmt.Println(Generate("{firstname} {lastname} ssn is {ssn} and lives at {street}"))
fmt.Println(Generate("{sentence:3}"))
fmt.Println(Generate("{shuffleints:[1,2,3]}"))
fmt.Println(Generate("{number:1,50}"))
fmt.Println(Generate("{shufflestrings:[key:value,int:string,1:2,a:b]}"))
Output:

Markus Moen ssn is 952284213 and lives at 599 New Cliffs stad
Arrival tour security.
[1 3 2]
34
[a:b key:value int:string 1:2]

func HTTPMethod

func HTTPMethod() string

HTTPMethod will generate a random http method

Example
Seed(11)
fmt.Println(HTTPMethod())
Output:

HEAD

func HTTPStatusCode

func HTTPStatusCode() int

HTTPStatusCode will generate a random status code

Example
Seed(11)
fmt.Println(HTTPStatusCode())
Output:

404

func HTTPStatusCodeSimple

func HTTPStatusCodeSimple() int

HTTPStatusCodeSimple will generate a random simple status code

Example
Seed(11)
fmt.Println(HTTPStatusCodeSimple())
Output:

200

func HackerAbbreviation

func HackerAbbreviation() string

HackerAbbreviation will return a random hacker abbreviation

Example
Seed(11)
fmt.Println(HackerAbbreviation())
Output:

ADP

func HackerAdjective

func HackerAdjective() string

HackerAdjective will return a random hacker adjective

Example
Seed(11)
fmt.Println(HackerAdjective())
Output:

wireless

func HackerNoun

func HackerNoun() string

HackerNoun will return a random hacker noun

Example
Seed(11)
fmt.Println(HackerNoun())
Output:

driver

func HackerPhrase

func HackerPhrase() string

HackerPhrase will return a random hacker sentence

Example
Seed(11)
fmt.Println(HackerPhrase())
Output:

If we calculate the program, we can get to the AI pixel through the redundant XSS matrix!

func HackerVerb

func HackerVerb() string

HackerVerb will return a random hacker verb

Example
Seed(11)
fmt.Println(HackerVerb())
Output:

synthesize

func HackeringVerb

func HackeringVerb() string

HackeringVerb will return a random hacker ingverb

Example
Seed(11)
fmt.Println(HackeringVerb())
Output:

connecting

func HexColor

func HexColor() string

HexColor will generate a random hexadecimal color string

Example
Seed(11)
fmt.Println(HexColor())
Output:

#a99fb4

func HipsterParagraph

func HipsterParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string

HipsterParagraph will generate a random paragraphGenerator Set Paragraph Count Set Sentence Count Set Word Count Set Paragraph Separator

Example
Seed(11)
fmt.Println(HipsterParagraph(3, 5, 12, "\n"))
Output:

Microdosing roof chia echo pickled meditation cold-pressed raw denim fingerstache normcore sriracha pork belly. Wolf try-hard pop-up blog tilde hashtag health butcher waistcoat paleo portland vinegar. Microdosing sartorial blue bottle slow-carb freegan five dollar toast you probably haven't heard of them asymmetrical chia farm-to-table narwhal banjo. Gluten-free blog authentic literally synth vinyl meh ethical health fixie banh mi Yuccie. Try-hard drinking squid seitan cray VHS echo chillwave hammock kombucha food truck sustainable.
Pug bushwick hella tote bag cliche direct trade waistcoat yr waistcoat knausgaard pour-over master. Pitchfork jean shorts franzen flexitarian distillery hella meggings austin knausgaard crucifix wolf heirloom. Crucifix food truck you probably haven't heard of them trust fund fixie gentrify pitchfork stumptown mlkshk umami chambray blue bottle. 3 wolf moon swag +1 biodiesel knausgaard semiotics taxidermy meh artisan hoodie +1 blue bottle. Fashion axe forage mixtape Thundercats pork belly whatever 90's beard selfies chambray cred mlkshk.
Shabby chic typewriter VHS readymade lo-fi bitters PBR&B gentrify lomo raw denim freegan put a bird on it. Raw denim cliche dreamcatcher pug fixie park trust fund migas fingerstache sriracha +1 mustache. Tilde shoreditch kickstarter franzen dreamcatcher green juice mustache neutra polaroid stumptown organic schlitz. Flexitarian ramps chicharrones kogi lo-fi mustache tilde forage street church-key williamsburg taxidermy. Chia mustache plaid mumblecore squid slow-carb disrupt Thundercats goth shoreditch master direct trade.

func HipsterSentence

func HipsterSentence(wordCount int) string

HipsterSentence will generate a random sentence

Example
Seed(11)
fmt.Println(HipsterSentence(5))
Output:

Microdosing roof chia echo pickled.

func HipsterWord

func HipsterWord() string

HipsterWord will return a single hipster word

Example
Seed(11)
fmt.Println(HipsterWord())
Output:

microdosing

func Hour

func Hour() int

Hour will generate a random hour - in military time

Example
Seed(11)
fmt.Println(Hour())
Output:

0

func IPv4Address

func IPv4Address() string

IPv4Address will generate a random version 4 ip address

Example
Seed(11)
fmt.Println(IPv4Address())
Output:

222.83.191.222

func IPv6Address

func IPv6Address() string

IPv6Address will generate a random version 6 ip address

Example
Seed(11)
fmt.Println(IPv6Address())
Output:

2001:cafe:8898:ee17:bc35:9064:5866:d019

func Image

func Image(width int, height int) *image.RGBA

Image generates a random rgba image

func ImageJpeg

func ImageJpeg(width int, height int) []byte

ImageJpeg generates a random rgba jpeg image

func ImagePng

func ImagePng(width int, height int) []byte

ImagePng generates a random rgba png image

func ImageURL

func ImageURL(width int, height int) string

ImageURL will generate a random Image Based Upon Height And Width. https://picsum.photos/

Example
Seed(11)
fmt.Println(ImageURL(640, 480))
Output:

https://picsum.photos/640/480

func Int16

func Int16() int16

Int16 will generate a random int16 value

Example
Seed(11)
fmt.Println(Int16())
Output:

2200

func Int32

func Int32() int32

Int32 will generate a random int32 value

Example
Seed(11)
fmt.Println(Int32())
Output:

-1072427943

func Int64

func Int64() int64

Int64 will generate a random int64 value

Example
Seed(11)
fmt.Println(Int64())
Output:

-8379641344161477543

func Int8

func Int8() int8

Int8 will generate a random Int8 value

Example
Seed(11)
fmt.Println(Int8())
Output:

24

func JSON

func JSON(jo *JSONOptions) ([]byte, error)

JSON generates an object or an array of objects in json format

Example (Array)
Seed(11)

value, err := JSON(&JSONOptions{
	Type: "array",
	Fields: []Field{
		{Name: "id", Function: "autoincrement"},
		{Name: "first_name", Function: "firstname"},
		{Name: "last_name", Function: "lastname"},
		{Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}},
	},
	RowCount: 3,
	Indent:   true,
})
if err != nil {
	fmt.Println(err)
}

fmt.Println(string(value))
Output:

[
    {
        "id": 1,
        "first_name": "Markus",
        "last_name": "Moen",
        "password": "Dc0VYXjkWABx"
    },
    {
        "id": 2,
        "first_name": "Osborne",
        "last_name": "Hilll",
        "password": "XPJ9OVNbs5lm"
    },
    {
        "id": 3,
        "first_name": "Mertie",
        "last_name": "Halvorson",
        "password": "eyl3bhwfV8wA"
    }
]
Example (Object)
Seed(11)

value, err := JSON(&JSONOptions{
	Type: "object",
	Fields: []Field{
		{Name: "first_name", Function: "firstname"},
		{Name: "last_name", Function: "lastname"},
		{Name: "address", Function: "address"},
		{Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}},
	},
	Indent: true,
})
if err != nil {
	fmt.Println(err)
}

fmt.Println(string(value))
Output:

{
    "first_name": "Markus",
    "last_name": "Moen",
    "address": {
        "address": "4599 Dale ton, Lake Carroll, Mississippi 90635",
        "street": "4599 Dale ton",
        "city": "Lake Carroll",
        "state": "Mississippi",
        "zip": "90635",
        "country": "Saint Pierre and Miquelon",
        "latitude": 22.008873,
        "longitude": 158.531956
    },
    "password": "YjJbXclnVN0H"
}

func JobDescriptor

func JobDescriptor() string

JobDescriptor will generate a random job descriptor string

Example
Seed(11)
fmt.Println(JobDescriptor())
Output:

Central

func JobLevel

func JobLevel() string

JobLevel will generate a random job level string

Example
Seed(11)
fmt.Println(JobLevel())
Output:

Assurance

func JobTitle

func JobTitle() string

JobTitle will generate a random job title string

Example
Seed(11)
fmt.Println(JobTitle())
Output:

Director

func Language

func Language() string

Language will return a random language

Example
Seed(11)
fmt.Println(Language())
Output:

Kazakh

func LanguageAbbreviation

func LanguageAbbreviation() string

LanguageAbbreviation will return a random language abbreviation

Example
Seed(11)
fmt.Println(LanguageAbbreviation())
Output:

kk

func LastName

func LastName() string

LastName will generate a random last name

Example
Seed(11)
fmt.Println(LastName())
Output:

Daniel

func Latitude

func Latitude() float64

Latitude will generate a random latitude float64

Example
Seed(11)
fmt.Println(Latitude())
Output:

-73.534057

func LatitudeInRange

func LatitudeInRange(min, max float64) (float64, error)

LatitudeInRange will generate a random latitude within the input range

Example
Seed(11)
lat, _ := LatitudeInRange(21, 42)
fmt.Println(lat)
Output:

22.921026

func Letter

func Letter() string

Letter will generate a single random lower case ASCII letter

Example
Seed(11)
fmt.Println(Letter())
Output:

g

func Lexify

func Lexify(str string) string

Lexify will replace ? will random generated letters

Example
Seed(11)
fmt.Println(Lexify("?????"))
Output:

gbRMa

func LogLevel

func LogLevel(logType string) string

LogLevel will generate a random log level See data/LogLevels for list of available levels

Example
Seed(11)
fmt.Println(LogLevel("")) // This will also use general
fmt.Println(LogLevel("syslog"))
fmt.Println(LogLevel("apache"))
Output:

error
debug
trace1-8

func Longitude

func Longitude() float64

Longitude will generate a random longitude float64

Example
Seed(11)
fmt.Println(Longitude())
Output:

-147.068113

func LongitudeInRange

func LongitudeInRange(min, max float64) (float64, error)

LongitudeInRange will generate a random longitude within the input range

Example
Seed(11)
long, _ := LongitudeInRange(-10, 10)
fmt.Println(long)
Output:

-8.170451

func LoremIpsumParagraph

func LoremIpsumParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string

LoremIpsumParagraph will generate a random paragraphGenerator

Example
Seed(11)
fmt.Println(LoremIpsumParagraph(3, 5, 12, "\n"))
Output:

Quia quae repellat consequatur quidem nisi quo qui voluptatum accusantium quisquam amet. Quas et ut non dolorem ipsam aut enim assumenda mollitia harum ut. Dicta similique veniam nulla voluptas at excepturi non ad maxime at non. Eaque hic repellat praesentium voluptatem qui consequuntur dolor iusto autem velit aut. Fugit tempore exercitationem harum consequatur voluptatum modi minima aut eaque et et.
Aut ea voluptatem dignissimos expedita odit tempore quod aut beatae ipsam iste. Minus voluptatibus dolorem maiores eius sed nihil vel enim odio voluptatem accusamus. Natus quibusdam temporibus tenetur cumque sint necessitatibus dolorem ex ducimus iusto ex. Voluptatem neque dicta explicabo officiis et ducimus sit ut ut praesentium pariatur. Illum molestias nisi at dolore ut voluptatem accusantium et fugiat et ut.
Explicabo incidunt reprehenderit non quia dignissimos recusandae vitae soluta quia et quia. Aut veniam voluptas consequatur placeat sapiente non eveniet voluptatibus magni velit eum. Nobis vel repellendus sed est qui autem laudantium quidem quam ullam consequatur. Aut iusto ut commodi similique quae voluptatem atque qui fugiat eum aut. Quis distinctio consequatur voluptatem vel aliquid aut laborum facere officiis iure tempora.

func LoremIpsumSentence

func LoremIpsumSentence(wordCount int) string

LoremIpsumSentence will generate a random sentence

Example
Seed(11)
fmt.Println(LoremIpsumSentence(5))
Output:

Quia quae repellat consequatur quidem.

func LoremIpsumWord

func LoremIpsumWord() string

LoremIpsumWord will generate a random word

Example
Seed(11)
fmt.Println(LoremIpsumWord())
Output:

quia

func Lunch

func Lunch() string

Lunch will return a random lunch name

Example
Seed(11)
fmt.Println(Lunch())
Output:

No bake hersheys bar pie

func MacAddress

func MacAddress() string

MacAddress will generate a random mac address

Example
Seed(11)
fmt.Println(MacAddress())
Output:

e1:74:cb:01:77:91

func Map

func Map() map[string]interface{}

Map will generate a random set of map data

Example
Seed(11)

fmt.Println(Map())
Output:

map[approach:map[mind:[arrival should resolve outcome hurt]] arrive:Coordinator consult:respond context:9285735 water:5081652]

func Minute

func Minute() int

Minute will generate a random minute

Example
Seed(11)
fmt.Println(Minute())
Output:

0

func Month

func Month() string

Month will generate a random month string

Example
Seed(11)
fmt.Println(Month())
Output:

January

func Name

func Name() string

Name will generate a random First and Last Name

Example
Seed(11)
fmt.Println(Name())
Output:

Markus Moen

func NamePrefix

func NamePrefix() string

NamePrefix will generate a random name prefix

Example
Seed(11)
fmt.Println(NamePrefix())
Output:

Mr.

func NameSuffix

func NameSuffix() string

NameSuffix will generate a random name suffix

Example
Seed(11)
fmt.Println(NameSuffix())
Output:

Jr.

func NanoSecond

func NanoSecond() int

NanoSecond will generate a random nano second

Example
Seed(11)
fmt.Println(NanoSecond())
Output:

196446360

func Noun

func Noun() string

Noun will generate a random noun

Example
Seed(11)
fmt.Println(Noun())
Output:

foot

func Number

func Number(min int, max int) int

Number will generate a random number between given min And max

Example
Seed(11)
fmt.Println(Number(50, 23456))
Output:

14866

func Numerify

func Numerify(str string) string

Numerify will replace # with random numerical values

Example
Seed(11)
fmt.Println(Numerify("###-###-####"))
Output:

613-645-9948

func OperaUserAgent

func OperaUserAgent() string

OperaUserAgent will generate a random opera browser user agent string

Example
Seed(11)
fmt.Println(OperaUserAgent())
Output:

Opera/8.39 (Macintosh; U; PPC Mac OS X 10_8_7; en-US) Presto/2.9.335 Version/10.00

func Paragraph

func Paragraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string

Paragraph will generate a random paragraphGenerator

Example
Seed(11)
fmt.Println(Paragraph(3, 5, 12, "\n"))
Output:

Interpret context record river mind press self should compare property outcome divide. Combine approach sustain consult discover explanation direct address church husband seek army. Begin own act welfare replace press suspect stay link place manchester specialist. Arrive price satisfy sign force application hair train provide basis right pay. Close mark teacher strengthen information attempt head touch aim iron tv take.
Handle wait begin look speech trust cancer visit capacity disease chancellor clean. Race aim function gain couple push faith enjoy admit ring attitude develop. Edge game prevent cast mill favour father star live search aim guess. West heart item adopt compete equipment miss output report communicate model cabinet. Seek worker variety step argue air improve give succeed relief artist suffer.
Hide finish insist knowledge thatcher make research chance structure proportion husband implement. Town crown restaurant cost material compete lady climb football region discussion order. Place lee market ice like display mind stress compete weather station raise. Democracy college major recall struggle use cut intention accept period generation strike. Benefit defend recommend conclude justify result depend succeed address owner fill interpret.

func Password

func Password(lower bool, upper bool, numeric bool, special bool, space bool, num int) string

Password will generate a random password Minimum number length of 5 if less than

Example
Seed(11)
fmt.Println(Password(true, false, false, false, false, 32))
fmt.Println(Password(false, true, false, false, false, 32))
fmt.Println(Password(false, false, true, false, false, 32))
fmt.Println(Password(false, false, false, true, false, 32))
fmt.Println(Password(true, true, true, true, true, 32))
fmt.Println(Password(true, true, true, true, true, 4))
Output:

vodnqxzsuptgehrzylximvylxzoywexw
ZSRQWJFJWCSTVGXKYKWMLIAFGFELFJRG
61718615932495608398906260648432
@$,@#:,(,).{?:%?)>*..<=};#$(:{==
CkF{wwb:?Kb},w?vdz{Zox C&>Prt99:
j ;9X

func PetName

func PetName() string

PetName will return a random fun pet name

Example
Seed(11)
fmt.Println(PetName())
Output:

Ozzy Pawsborne

func Phone

func Phone() string

Phone will generate a random phone number string

Example
Seed(11)
fmt.Println(Phone())
Output:

6136459948

func PhoneFormatted

func PhoneFormatted() string

PhoneFormatted will generate a random phone number string

Example
Seed(11)
fmt.Println(PhoneFormatted())
Output:

136-459-9489

func Phrase

func Phrase() string

Phrase will return a random dictionary phrase

Example
Seed(11)
fmt.Println(Phrase())
Output:

shut the front door

func Preposition

func Preposition() string

Preposition will generate a random preposition

Example
Seed(11)
fmt.Println(Preposition())
Output:

down

func Price

func Price(min, max float64) float64

Price will take in a min and max value and return a formatted price

Example
Seed(11)
fmt.Printf("%.2f", Price(0.8618, 1000))
Output:

92.26

func ProgrammingLanguage

func ProgrammingLanguage() string

ProgrammingLanguage will return a random programming language

Example
Seed(464)
fmt.Println(ProgrammingLanguage())
Output:

Go

func ProgrammingLanguageBest

func ProgrammingLanguageBest() string

ProgrammingLanguageBest will return a random programming language

Example
Seed(11)
fmt.Println(ProgrammingLanguageBest())
Output:

Go

func Question

func Question() string

Question will return a random question

Example
Seed(11)
fmt.Println(Question())
Output:

Roof chia echo?

func Quote

func Quote() string

Quote will return a random quote from a random person

Example
Seed(11)
fmt.Println(Quote())
Output:

"Roof chia echo." - Lura Lockman

func RGBColor

func RGBColor() []int

RGBColor will generate a random int slice color

Example
Seed(11)
fmt.Println(RGBColor())
Output:

[152 23 53]

func RandomInt

func RandomInt(i []int) int

RandomInt will take in a slice of int and return a randomly selected value

Example
Seed(11)

ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657}
RandomInt(ints)
fmt.Println(RandomInt(ints))
Output:

841657

func RandomString

func RandomString(a []string) string

RandomString will take in a slice of string and return a randomly selected value

Example
Seed(11)
fmt.Println(RandomString([]string{"hello", "world"}))
Output:

hello

func RandomUint

func RandomUint(i []uint) uint

RandomUint will take in a slice of uint and return a randomly selected value

Example
Seed(11)

ints := []uint{52, 854, 941, 74125, 8413, 777, 89416, 841657}
RandomUint(ints)
fmt.Println(RandomUint(ints))
Output:

841657

func Regex

func Regex(regexStr string) string

Regex will generate a string based upon a RE2 syntax

Example
Seed(11)

fmt.Println(Regex("[abcdef]{5}"))
fmt.Println(Regex("[[:upper:]]{5}"))
fmt.Println(Regex("(hello|world|whats|up)"))
fmt.Println(Regex(`^[a-z]{5,10}@[a-z]{5,10}\.(com|net|org)$`))
Output:

affec
RXHKI
up
ptapwy@dnsmkgtl.com

func RemoveFuncLookup

func RemoveFuncLookup(functionName string)

RemoveFuncLookup will remove a function from lookup

func SSN

func SSN() string

SSN will generate a random Social Security Number

Example
Seed(11)
fmt.Println(SSN())
Output:

296446360

func SafariUserAgent

func SafariUserAgent() string

SafariUserAgent will generate a random safari browser user agent string

Example
Seed(11)
fmt.Println(SafariUserAgent())
Output:

Mozilla/5.0 (iPad; CPU OS 8_3_2 like Mac OS X; en-US) AppleWebKit/531.15.6 (KHTML, like Gecko) Version/4.0.5 Mobile/8B120 Safari/6531.15.6

func SafeColor

func SafeColor() string

SafeColor will generate a random safe color string

Example
Seed(11)
fmt.Println(SafeColor())
Output:

black

func Second

func Second() int

Second will generate a random second

Example
Seed(11)
fmt.Println(Second())
Output:

0

func Seed

func Seed(seed int64)

Seed random. Setting seed to 0 will use time.Now().UnixNano()

func Sentence

func Sentence(wordCount int) string

Sentence will generate a random sentence

Example
Seed(11)
fmt.Println(Sentence(5))
Output:

Interpret context record river mind.

func ShuffleInts

func ShuffleInts(a []int)

ShuffleInts will randomize a slice of ints

Example
Seed(11)

ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657}
ShuffleInts(ints)
fmt.Println(ints)
Output:

[74125 777 941 89416 8413 854 52 841657]

func ShuffleStrings

func ShuffleStrings(a []string)

ShuffleStrings will randomize a slice of strings

Example
Seed(11)
strings := []string{"happy", "times", "for", "everyone", "have", "a", "good", "day"}
ShuffleStrings(strings)
fmt.Println(strings)
Output:

[good everyone have for times a day happy]

func Snack

func Snack() string

Snack will return a random snack name

Example
Seed(11)
fmt.Println(Snack())
Output:

Hoisin marinated wing pieces

func State

func State() string

State will generate a random state string

Example
Seed(11)
fmt.Println(State())
Output:

Hawaii

func StateAbr

func StateAbr() string

StateAbr will generate a random abbreviated state string

Example
Seed(11)
fmt.Println(StateAbr())
Output:

OR

func Street

func Street() (street string)

Street will generate a random address street string

Example
Seed(11)
fmt.Println(Street())
Output:

364 East Rapids borough

func StreetName

func StreetName() string

StreetName will generate a random address street name string

Example
Seed(11)
fmt.Println(StreetName())
Output:

View

func StreetNumber

func StreetNumber() string

StreetNumber will generate a random address street number string

Example
Seed(11)
fmt.Println(StreetNumber())
Output:

13645

func StreetPrefix

func StreetPrefix() string

StreetPrefix will generate a random address street prefix string

Example
Seed(11)
fmt.Println(StreetPrefix())
Output:

Lake

func StreetSuffix

func StreetSuffix() string

StreetSuffix will generate a random address street suffix string

Example
Seed(11)
fmt.Println(StreetSuffix())
Output:

land

func Struct

func Struct(v interface{})

Struct fills in exported elements of a struct with random data based on the value of `fake` tag of exported elements. Use `fake:"skip"` to explicitly skip an element. All built-in types are supported, with templating support for string types.

func Teams

func Teams(people []string, teams []string) map[string][]string

Teams takes in an array of people and team names and randomly places the people into teams as evenly as possible

Example
Seed(11)
fmt.Println(Teams(
	[]string{"Billy", "Sharon", "Jeff", "Connor", "Steve", "Justin", "Fabian", "Robert"},
	[]string{"Team 1", "Team 2", "Team 3"},
))
Output:

map[Team 1:[Fabian Connor Steve] Team 2:[Jeff Sharon Justin] Team 3:[Robert Billy]]

func TimeZone

func TimeZone() string

TimeZone will select a random timezone string

Example
Seed(11)
fmt.Println(TimeZone())
Output:

Kaliningrad Standard Time

func TimeZoneAbv

func TimeZoneAbv() string

TimeZoneAbv will select a random timezone abbreviation string

Example
Seed(11)
fmt.Println(TimeZoneAbv())
Output:

KST

func TimeZoneFull

func TimeZoneFull() string

TimeZoneFull will select a random full timezone string

Example
Seed(11)
fmt.Println(TimeZoneFull())
Output:

(UTC+03:00) Kaliningrad, Minsk

func TimeZoneOffset

func TimeZoneOffset() float32

TimeZoneOffset will select a random timezone offset

Example
Seed(11)
fmt.Println(TimeZoneOffset())
Output:

3

func TimeZoneRegion

func TimeZoneRegion() string

TimeZoneRegion will select a random region style timezone string, e.g. "America/Chicago"

Example
Seed(11)
fmt.Println(TimeZoneRegion())
Output:

America/Vancouver

func URL

func URL() string

URL will generate a random url string

Example
Seed(11)
fmt.Println(URL())
Output:

http://www.principalproductize.biz/target

func UUID

func UUID() string

UUID (version 4) will generate a random unique identifier based upon random nunbers Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Example
Seed(11)
fmt.Println(UUID())
Output:

590c1440-9888-45b0-bd51-a817ee07c3f2

func Uint16

func Uint16() uint16

Uint16 will generate a random uint16 value

Example
Seed(11)
fmt.Println(Uint16())
Output:

34968

func Uint32

func Uint32() uint32

Uint32 will generate a random uint32 value

Example
Seed(11)
fmt.Println(Uint32())
Output:

1075055705

func Uint64

func Uint64() uint64

Uint64 will generate a random uint64 value

Example
Seed(11)
fmt.Println(Uint64())
Output:

843730692693298265

func Uint8

func Uint8() uint8

Uint8 will generate a random uint8 value

Example
Seed(11)
fmt.Println(Uint8())
Output:

152

func UserAgent

func UserAgent() string

UserAgent will generate a random broswer user agent

Example
Seed(11)
fmt.Println(UserAgent())
Output:

Mozilla/5.0 (Windows NT 5.0) AppleWebKit/5362 (KHTML, like Gecko) Chrome/37.0.834.0 Mobile Safari/5362

func Username

func Username() string

Username will genrate a random username based upon picking a random lastname and random numbers at the end

Example
Seed(11)
fmt.Println(Username())
Output:

Daniel1364

func Vegetable

func Vegetable() string

Vegetable will return a random vegetable name

Example
Seed(11)
fmt.Println(Vegetable())
Output:

Amaranth Leaves

func Verb

func Verb() string

Verb will generate a random verb

Example
Seed(11)
fmt.Println(Verb())
Output:

release

func WeekDay

func WeekDay() string

WeekDay will generate a random weekday string (Monday-Sunday)

Example
Seed(11)
fmt.Println(WeekDay())
Output:

Friday

func Word

func Word() string

Word will generate a random word

Example
Seed(11)
fmt.Println(Word())
Output:

interpret

func XML

func XML(xo *XMLOptions) ([]byte, error)

XML generates an object or an array of objects in json format

Example (Array)
Seed(11)

value, err := XML(&XMLOptions{
	Type:          "array",
	RootElement:   "xml",
	RecordElement: "record",
	RowCount:      2,
	Indent:        true,
	Fields: []Field{
		{Name: "first_name", Function: "firstname"},
		{Name: "last_name", Function: "lastname"},
		{Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}},
	},
})
if err != nil {
	fmt.Println(err)
}

fmt.Println(string(value))
Output:

<xml>
    <record>
        <first_name>Markus</first_name>
        <last_name>Moen</last_name>
        <password>Dc0VYXjkWABx</password>
    </record>
    <record>
        <first_name>Osborne</first_name>
        <last_name>Hilll</last_name>
        <password>XPJ9OVNbs5lm</password>
    </record>
</xml>
Example (Single)
Seed(11)

value, err := XML(&XMLOptions{
	Type:          "single",
	RootElement:   "xml",
	RecordElement: "record",
	RowCount:      2,
	Indent:        true,
	Fields: []Field{
		{Name: "first_name", Function: "firstname"},
		{Name: "last_name", Function: "lastname"},
		{Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}},
	},
})
if err != nil {
	fmt.Println(err)
}

fmt.Println(string(value))
Output:

<xml>
    <first_name>Markus</first_name>
    <last_name>Moen</last_name>
    <password>Dc0VYXjkWABx</password>
</xml>

func Year

func Year() int

Year will generate a random year between 1900 - current year

Example
Seed(11)
fmt.Println(Year())
Output:

1977

func Zip

func Zip() string

Zip will generate a random Zip code string

Example
Seed(11)
fmt.Println(Zip())
Output:

13645

Types

type AddressInfo

type AddressInfo struct {
	Address   string  `json:"address" xml:"address"`
	Street    string  `json:"street" xml:"street"`
	City      string  `json:"city" xml:"city"`
	State     string  `json:"state" xml:"state"`
	Zip       string  `json:"zip" xml:"zip"`
	Country   string  `json:"country" xml:"country"`
	Latitude  float64 `json:"latitude" xml:"latitude"`
	Longitude float64 `json:"longitude" xml:"longitude"`
}

AddressInfo is a struct full of address information

func Address

func Address() *AddressInfo

Address will generate a struct of address information

Example
Seed(11)
address := Address()
fmt.Println(address.Address)
fmt.Println(address.Street)
fmt.Println(address.City)
fmt.Println(address.State)
fmt.Println(address.Zip)
fmt.Println(address.Country)
fmt.Println(address.Latitude)
fmt.Println(address.Longitude)
Output:

364 East Rapids borough, Rutherfordstad, New Jersey 36906
364 East Rapids borough
Rutherfordstad
New Jersey
36906
South Africa
23.058758
89.022594

type CSVOptions

type CSVOptions struct {
	Delimiter string  `json:"delimiter" xml:"delimiter"`
	RowCount  int     `json:"row_count" xml:"row_count"`
	Fields    []Field `json:"fields" xml:"fields"`
}

CSVOptions defines values needed for csv generation

type CarInfo

type CarInfo struct {
	Type         string `json:"type" xml:"type"`
	Fuel         string `json:"fuel" xml:"fuel"`
	Transmission string `json:"transmission" xml:"transmission"`
	Brand        string `json:"brand" xml:"brand"`
	Model        string `json:"model" xml:"model"`
	Year         int    `json:"year" xml:"year"`
}

CarInfo is a struct dataset of all car information

func Car

func Car() *CarInfo

Car will generate a struct with car information

Example
Seed(11)
car := Car()
fmt.Println(car.Brand)
fmt.Println(car.Fuel)
fmt.Println(car.Model)
fmt.Println(car.Transmission)
fmt.Println(car.Type)
fmt.Println(car.Year)
Output:

Fiat
Gasoline
Freestyle Fwd
Automatic
Passenger car mini
1972

type ContactInfo

type ContactInfo struct {
	Phone string `json:"phone" xml:"phone"`
	Email string `json:"email" xml:"email"`
}

ContactInfo struct full of contact info

func Contact

func Contact() *ContactInfo

Contact will generate a struct with information randomly populated contact information

Example
Seed(11)
contact := Contact()
fmt.Println(contact.Phone)
fmt.Println(contact.Email)
Output:

6136459948
carolecarroll@bosco.com

type CreditCardInfo

type CreditCardInfo struct {
	Type   string `json:"type" xml:"type"`
	Number string `json:"number" xml:"number"`
	Exp    string `json:"exp" xml:"exp"`
	Cvv    string `json:"cvv" xml:"cvv"`
}

CreditCardInfo is a struct containing credit variables

func CreditCard

func CreditCard() *CreditCardInfo

CreditCard will generate a struct full of credit card information

Example
Seed(11)
ccInfo := CreditCard()
fmt.Println(ccInfo.Type)
fmt.Println(ccInfo.Number)
fmt.Println(ccInfo.Exp)
fmt.Println(ccInfo.Cvv)
Output:

UnionPay
4645994899536906358
11/21
259

type CreditCardOptions

type CreditCardOptions struct {
	Types []string `json:"types"`
	Bins  []string `json:"bins"` // optional parameter of prepended numbers
	Gaps  bool     `json:"gaps"`
}

CreditCardOptions is the options for credit card number

type CurrencyInfo

type CurrencyInfo struct {
	Short string `json:"short" xml:"short"`
	Long  string `json:"long" xml:"long"`
}

CurrencyInfo is a struct of currency information

func Currency

func Currency() *CurrencyInfo

Currency will generate a struct with random currency information

Example
Seed(11)
currency := Currency()
fmt.Printf("%s - %s", currency.Short, currency.Long)
Output:

IQD - Iraq Dinar

type Field

type Field struct {
	Name     string              `json:"name"`
	Function string              `json:"function"`
	Params   map[string][]string `json:"params"`
}

Field is used for defining what name and function you to generate for file outuputs

type Info

type Info struct {
	Display     string                                                        `json:"display"`
	Category    string                                                        `json:"category"`
	Description string                                                        `json:"description"`
	Example     string                                                        `json:"example"`
	Output      string                                                        `json:"output"`
	Data        map[string]string                                             `json:"-"`
	Params      []Param                                                       `json:"params"`
	Call        func(m *map[string][]string, info *Info) (interface{}, error) `json:"-"`
}

Info structures fields to better break down what each one generates

func GetFuncLookup

func GetFuncLookup(functionName string) *Info

GetFuncLookup will lookup

func (*Info) GetBool

func (i *Info) GetBool(m *map[string][]string, field string) (bool, error)

GetBool will retrieve boolean field from data

func (*Info) GetField

func (i *Info) GetField(m *map[string][]string, field string) (*Param, []string, error)

GetField will retrieve field from data

func (*Info) GetFloat32

func (i *Info) GetFloat32(m *map[string][]string, field string) (float32, error)

GetFloat32 will retrieve int field from data

func (*Info) GetFloat64

func (i *Info) GetFloat64(m *map[string][]string, field string) (float64, error)

GetFloat64 will retrieve int field from data

func (*Info) GetInt

func (i *Info) GetInt(m *map[string][]string, field string) (int, error)

GetInt will retrieve int field from data

func (*Info) GetIntArray

func (i *Info) GetIntArray(m *map[string][]string, field string) ([]int, error)

GetIntArray will retrieve []int field from data

func (*Info) GetString

func (i *Info) GetString(m *map[string][]string, field string) (string, error)

GetString will retrieve string field from data

func (*Info) GetStringArray

func (i *Info) GetStringArray(m *map[string][]string, field string) ([]string, error)

GetStringArray will retrieve []string field from data

func (*Info) GetUint

func (i *Info) GetUint(m *map[string][]string, field string) (uint, error)

GetUint will retrieve uint field from data

type JSONOptions

type JSONOptions struct {
	Type     string  `json:"type" xml:"type"` // array or object
	RowCount int     `json:"row_count" xml:"row_count"`
	Fields   []Field `json:"fields" xml:"fields"`
	Indent   bool    `json:"indent" xml:"indent"`
}

JSONOptions defines values needed for json generation

type JobInfo

type JobInfo struct {
	Company    string `json:"company" xml:"company"`
	Title      string `json:"title" xml:"title"`
	Descriptor string `json:"descriptor" xml:"descriptor"`
	Level      string `json:"level" xml:"level"`
}

JobInfo is a struct of job information

func Job

func Job() *JobInfo

Job will generate a struct with random job information

Example
Seed(11)
jobInfo := Job()
fmt.Println(jobInfo.Company)
fmt.Println(jobInfo.Title)
fmt.Println(jobInfo.Descriptor)
fmt.Println(jobInfo.Level)
Output:

ClearHealthCosts
Agent
Future
Tactics

type Param

type Param struct {
	Field       string   `json:"field"`
	Display     string   `json:"display"`
	Type        string   `json:"type"`
	Default     string   `json:"default"`
	Options     []string `json:"options"`
	Description string   `json:"description"`
}

Param is a breakdown of param requirements and type definition

type PersonInfo

type PersonInfo struct {
	FirstName  string          `json:"first_name" xml:"first_name"`
	LastName   string          `json:"last_name" xml:"last_name"`
	Gender     string          `json:"gender" xml:"gender"`
	SSN        string          `json:"ssn" xml:"ssn"`
	Image      string          `json:"image" xml:"image"`
	Job        *JobInfo        `json:"job" xml:"job"`
	Address    *AddressInfo    `json:"address" xml:"address"`
	Contact    *ContactInfo    `json:"contact" xml:"contact"`
	CreditCard *CreditCardInfo `json:"credit_card" xml:"credit_card"`
}

PersonInfo is a struct of person information

func Person

func Person() *PersonInfo

Person will generate a struct with person information

Example
Seed(11)
person := Person()
job := person.Job
address := person.Address
contact := person.Contact
creditCard := person.CreditCard

fmt.Println(person.FirstName)
fmt.Println(person.LastName)
fmt.Println(person.Gender)
fmt.Println(person.SSN)
fmt.Println(person.Image)

fmt.Println(job.Company)
fmt.Println(job.Title)
fmt.Println(job.Descriptor)
fmt.Println(job.Level)

fmt.Println(address.Address)
fmt.Println(address.Street)
fmt.Println(address.City)
fmt.Println(address.State)
fmt.Println(address.Zip)
fmt.Println(address.Country)
fmt.Println(address.Latitude)
fmt.Println(address.Longitude)

fmt.Println(contact.Phone)
fmt.Println(contact.Email)

fmt.Println(creditCard.Type)
fmt.Println(creditCard.Number)
fmt.Println(creditCard.Exp)
fmt.Println(creditCard.Cvv)
Output:

Markus
Moen
male
420776036
https://picsum.photos/300/300/people
Morgan Stanley
Associate
Human
Usability
99536 North Stream ville, Rossieview, Hawaii 42591
99536 North Stream ville
Rossieview
Hawaii
42591
Burkina Faso
-6.662595
23.921575
3023202027
lamarkoelpin@heaney.biz
Maestro
39800889982276
05/29
932

type XMLOptions

type XMLOptions struct {
	Type          string  `json:"type" xml:"type"` // single or multiple
	RootElement   string  `json:"root_element" xml:"root_element"`
	RecordElement string  `json:"record_element" xml:"record_element"`
	RowCount      int     `json:"row_count" xml:"row_count"`
	Fields        []Field `json:"fields" xml:"fields"`
	Indent        bool    `json:"indent" xml:"indent"`
}

XMLOptions defines values needed for json generation

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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