faker

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: GPL-3.0 Imports: 18 Imported by: 1

Documentation

Overview

Package faker contains a random data generator (faker) with over 130 functions and has 2 modes: fast or (concurrent) safe. Can be used to mock data, test or stress test your systems or databases. You can generate almost anything, from names, addresses to prices and vehicle transmission types.

If you are looking for a HTTP service with the same functionality, not a package see Pseudoservice, it is a wrapper on FastFaker https://github.com/bgadrian/pseudoservice

Usage:

import "github.com/bgadrian/fastfaker/faker"

Method 1, use the Global instance (simple and concurrent safe):

fmt.Println("Name:", Global.Name()) //Name: Markus Moen

Method 2, instantiate a concurrent safe version:

faker := NewSafeFaker()
fmt.Println("Email:", faker.Email()) //kimsteuber@jones.com

Method 3, create a fast faker that is Not safe to use from multiple goroutines:

faker := NewFastFaker()
fmt.Println(Global.Template("{name} drinks {beername}.")) //Adrian drinks Duvel.

Fakers take their data from the github.com/bgadrian/fastfaker/data package. The pseudo-random algorithm is provided by the github.com/bgadrian/fastfaker/randomizer package, that is a wrapper of the rand package from the standard library.

For a more advanced overview of the Template feature see https://github.com/bgadrian/fastfaker/blob/master/TEMPLATES.md

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

Name: Markus Moen
Email: alaynawuckert@kozey.biz
Phone: 7625013191
Address: 8995 Wellport, North Denesik, Indiana 30042
BS: networks
Beer Name: Arrogant Bastard Ale
Color: Black
Company: Pagac, Ratke and Stracke
Credit Card: 6502027613217148
Hacker Phrase: Use the open-source JSON system, then you can bypass the optical microchip!
Job Title: Strategist
Password: SvH*aQzqA *snbo2?z-O=zJn1L# iu u
Currency: ZAR - South Africa Rand

Index

Examples

Constants

View Source
const TemplateAllowedDelimiters = "{}%#~<>-:@`"

TemplateAllowedDelimiters the runes that are allowed as variable delimiters in Custom Templates. Must be ASCII (1 byte size) and not interfere with the regex expressions.

Variables

View Source
var ErrRangeInvalid = errors.New("input range is invalid")

ErrRangeInvalid signals a bad input

Functions

This section is empty.

Types

type AddressInfo

type AddressInfo struct {
	Address   string
	Street    string
	City      string
	State     string
	Zip       string
	Country   string
	Latitude  float64
	Longitude float64
}

AddressInfo is a struct full of address information

type ContactInfo

type ContactInfo struct {
	Phone string
	Email string
}

ContactInfo struct full of contact info

type CreditCardInfo

type CreditCardInfo struct {
	Type   string
	Number int
	Exp    string
	Cvv    string
}

CreditCardInfo is a struct containing credit variables

type CurrencyInfo

type CurrencyInfo struct {
	Short string
	Long  string
}

CurrencyInfo is a struct of currency information

type Faker

type Faker struct {
	*randomizer.RandWrapper
}

Faker is the main strut that encapsulate all the package functionality.

var Global *Faker

Global is a singleton, safe for concurrency instance of a Faker.

func NewFastFaker

func NewFastFaker() *Faker

NewFastFaker generates a new Faker instance that CANNOT be used from multiple goroutines in the same time. Its state is non-deterministic (seeded with a random value) but you can use the .Seed() method. Use this faker when you want better performance in a multi-thread scenario.

Example
//create only one instance per goroutine!
faker := NewFastFaker()
faker.Seed(42)

fmt.Println("Name:", faker.Name())
fmt.Println("Email:", faker.Email())
Output:

Name: Jeromy Schmeler
Email: kimsteuber@jones.com

func NewSafeFaker

func NewSafeFaker() *Faker

NewSafeFaker creates a new Faker instance that can be used in a concurrent/parallel env. Its state is non-deterministic (seeded with a random value) but you can use the .Seed() method. It uses a mutex, so the performance may be affected.

func (*Faker) Address

func (f *Faker) Address() *AddressInfo

Address will generate a struct of address information

Example
Global.Seed(11)
address := Global.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)
// 872 East Rapidsborough, Rutherfordstad, New Jersey 74853
// 872 East Rapidsborough
// Rutherfordstad
// New Jersey
// 74853
// South Africa
// 23.05875828427908
// 89.02259415693374
Output:

func (*Faker) AvatarURL

func (f *Faker) AvatarURL() string

AvatarURL will generate a random image URL of 80x80 px. Images Provided by pipsum.com

Example
Global.Seed(42)
fmt.Println(Global.AvatarURL())
Output:

http://pipsum.com/80x80.jpg

func (*Faker) BS

func (f *Faker) BS() string

BS will generate a random company bs string

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

front-end

func (*Faker) BeerAlcohol

func (f *Faker) BeerAlcohol() string

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

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

2.7%

func (*Faker) BeerBlg

func (f *Faker) BeerBlg() string

BeerBlg will return a random beer blg between 5.0 and 20.0

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

6.4°Blg

func (*Faker) BeerHop

func (f *Faker) BeerHop() string

BeerHop will return a random beer hop

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

Glacier

func (*Faker) BeerIbu

func (f *Faker) BeerIbu() string

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

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

29 IBU

func (*Faker) BeerMalt

func (f *Faker) BeerMalt() string

BeerMalt will return a random beer malt

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

Munich

func (*Faker) BeerName

func (f *Faker) BeerName() string

BeerName will return a random beer name

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

Duvel

func (*Faker) BeerStyle

func (f *Faker) BeerStyle() string

BeerStyle will return a random beer style

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

European Amber Lager

func (*Faker) BeerYeast

func (f *Faker) BeerYeast() string

BeerYeast will return a random beer yeast

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

1388 - Belgian Strong Ale

func (*Faker) Binary

func (f *Faker) Binary() string

Binary will generate a random binary value "0" or "1" Can be used for configs or generating binary values.

Example
Global.Seed(11)
//will return a string value ("0" or "1")
fmt.Println(Global.Binary())
fmt.Println(Global.Binary())
Output:

0
1

func (*Faker) Bool

func (f *Faker) Bool() bool

Bool will generate a random boolean value

Example
Global.Seed(11)
//it returns a Go boolean value
fmt.Println(Global.Bool())
Output:

false

func (*Faker) BoolText

func (f *Faker) BoolText() string

BoolText will generate a random boolean value as text, "true" or "false". Can be used for JSON/YAML templates boolean values

Example
Global.Seed(11)
//wil return a string value ("true" or "false")
fmt.Println(Global.BoolText())
fmt.Println(Global.BoolText())
Output:

false
true

func (*Faker) Browser

func (f *Faker) Browser() string

Browser will generate a random browser name

func (*Faker) BuzzWord

func (f *Faker) BuzzWord() string

BuzzWord will generate a random company buzz word string

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

disintermediate

func (*Faker) CarMaker

func (f *Faker) CarMaker() string

CarMaker will generate a random car manufacturer

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

Nissan

func (*Faker) CarModel

func (f *Faker) CarModel() string

CarModel will generate a random car model

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

Aveo

func (*Faker) ChromeUserAgent

func (f *Faker) ChromeUserAgent() string

ChromeUserAgent will generate a random chrome browser user agent string

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

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

func (*Faker) City

func (f *Faker) City() (city string)

City will generate a random city string

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

Marcelside

func (*Faker) Color

func (f *Faker) Color() string

Color will generate a random color string

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

MediumOrchid

func (*Faker) Company

func (f *Faker) Company() (company string)

Company will generate a random company name string

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

Moen, Pagac and Wuckert

func (*Faker) CompanySuffix

func (f *Faker) CompanySuffix() string

CompanySuffix will generate a random company suffix string

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

Inc

func (*Faker) Contact

func (f *Faker) Contact() *ContactInfo

Contact will generate a struct with information randomly populated contact information

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

7787046119
marcelpagac@wuckert.biz

func (*Faker) Country

func (f *Faker) Country() string

Country will generate a random country string

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

Tajikistan

func (*Faker) CountryAbr

func (f *Faker) CountryAbr() string

CountryAbr will generate a random abbreviated country string

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

FI

func (*Faker) CreditCard

func (f *Faker) CreditCard() *CreditCardInfo

CreditCard will generate a struct full of credit card information

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

Visa
6536459948995369
03/26
353

func (*Faker) CreditCardCvv

func (f *Faker) CreditCardCvv() string

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

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

013

func (*Faker) CreditCardExp

func (f *Faker) CreditCardExp() string

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

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

01/21

func (*Faker) CreditCardNumber

func (f *Faker) CreditCardNumber() int

CreditCardNumber will generate a random credit card number int

Example
Global.Seed(11)
fmt.Println(Global.CreditCardNumber())
Output:

4136459948995369

func (*Faker) CreditCardNumberLuhn

func (f *Faker) CreditCardNumberLuhn() int

CreditCardNumberLuhn will generate a random credit card number int that passes luhn test

Example
Global.Seed(11)
fmt.Println(Global.CreditCardNumberLuhn())
Output:

2720996615546177

func (*Faker) CreditCardType

func (f *Faker) CreditCardType() string

CreditCardType will generate a random credit card type string

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

Visa

func (*Faker) Currency

func (f *Faker) Currency() *CurrencyInfo

Currency will generate a struct with random currency information

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

IQD - Iraq Dinar

func (*Faker) CurrencyLong

func (f *Faker) CurrencyLong() string

CurrencyLong will generate a random long currency name

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

Iraq Dinar

func (*Faker) CurrencyShort

func (f *Faker) CurrencyShort() string

CurrencyShort will generate a random short currency value

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

IQD

func (*Faker) Date

func (f *Faker) Date() time.Time

Date will generate a random time.Time struct between 1900-Now

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

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

func (*Faker) DateCurrentYear

func (f *Faker) DateCurrentYear() time.Time

DateCurrentYear will generate a random time.Time within the current year (UTC)

Example
Global.Seed(11)
fmt.Println(Global.DateCurrentYear().String())
Output:

2019-06-25 05:16:14.244961305 +0000 UTC

func (*Faker) DateCurrentYearStr

func (f *Faker) DateCurrentYearStr() string

DateCurrentYearStr will generate a random date-time within the current year (UTC) the format is: "2019-01-02 15:04:05.999999999 -0700 MST"

Example
Global.Seed(11)
fmt.Println(Global.DateCurrentYearStr())
Output:

2019-06-25 05:16:14.244961305 +0000 UTC

func (*Faker) DateRange

func (f *Faker) DateRange(start, end time.Time) time.Time

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

Example
Global.Seed(11)
fmt.Println(Global.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 (*Faker) DateStr

func (f *Faker) DateStr() string

DateStr will generate a random date-time between 1900-Now the format is: "2006-01-02 15:04:05.999999999 -0700 MST"

Example
Global.Seed(11)
fmt.Println(Global.DateStr())
Output:

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

func (*Faker) Day

func (f *Faker) Day() int

Day will generate a random day between 1 - 31

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

12

func (*Faker) Digit

func (f *Faker) Digit() string

Digit will generate a single ASCII digit

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

0

func (*Faker) DomainName

func (f *Faker) DomainName() string

DomainName will generate a random url domain name

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

centraltarget.biz

func (*Faker) DomainSuffix

func (f *Faker) DomainSuffix() string

DomainSuffix will generate a random domain suffix

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

org

func (*Faker) Email

func (f *Faker) Email() string

Email will generate a random email string

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

markusmoen@pagac.net

func (*Faker) Extension

func (f *Faker) Extension() string

Extension will generate a random file extension

Example
Global.Seed(11)
fmt.Println(Global.Extension())
Output:

nes

func (*Faker) FirefoxUserAgent

func (f *Faker) FirefoxUserAgent() string

FirefoxUserAgent will generate a random firefox broswer user agent string

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

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

func (*Faker) FirstName

func (f *Faker) FirstName() string

FirstName will generate a random first name

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

Markus

func (*Faker) FuelType

func (f *Faker) FuelType() string

FuelType will generate a random fuel type

Example
Global.Seed(11)
fmt.Println(Global.FuelType())
Output:

CNG

func (*Faker) Gender

func (f *Faker) Gender() string

Gender will generate a random gender string "male" or "female"

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

female

func (*Faker) HTTPMethod

func (f *Faker) HTTPMethod() string

HTTPMethod will generate a random http method

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

HEAD

func (*Faker) HackerAbbreviation

func (f *Faker) HackerAbbreviation() string

HackerAbbreviation will return a random hacker abbreviation

Example
Global.Seed(20)
fmt.Println(Global.HackerAbbreviation())
Output:

AGP

func (*Faker) HackerAdjective

func (f *Faker) HackerAdjective() string

HackerAdjective will return a random hacker adjective

Example
Global.Seed(20)
fmt.Println(Global.HackerAdjective())
Output:

online

func (*Faker) HackerIngverb

func (f *Faker) HackerIngverb() string

HackerIngverb will return a random hacker ingverb

Example
Global.Seed(20)
fmt.Println(Global.HackerIngverb())
Output:

navigating

func (*Faker) HackerNoun

func (f *Faker) HackerNoun() string

HackerNoun will return a random hacker noun

Example
Global.Seed(20)
fmt.Println(Global.HackerNoun())
Output:

pixel

func (*Faker) HackerPhrase

func (f *Faker) HackerPhrase() string

HackerPhrase will return a random hacker sentence

Example
Global.Seed(20)
fmt.Println(Global.HackerPhrase())
Output:

Connecting the array won't do anything, we need to generate the haptic COM driver!

func (*Faker) HackerVerb

func (f *Faker) HackerVerb() string

HackerVerb will return a random hacker verb

Example
Global.Seed(20)
fmt.Println(Global.HackerVerb())
Output:

connect

func (*Faker) HexColor

func (f *Faker) HexColor() string

HexColor will generate a random hexadecimal color string

Example
Global.Seed(42)
fmt.Println(Global.HexColor())
Output:

#1b4ef1

func (*Faker) Hexify

func (f *Faker) Hexify(str string) string

Hexify replace all 'h' characters to a random HEX rune

Example
Global.Seed(42)
fmt.Println(Global.Hexify("secret:hhhh-hhh"))
Output:

secret:1b4e-f15

func (*Faker) HipsterParagraph

func (f *Faker) 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
Global.Seed(11)
fmt.Println(Global.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 (*Faker) HipsterParagraphAvg

func (f *Faker) HipsterParagraphAvg() string

HipsterParagraphAvg will generate a 4 paragraph separated by Unix new line \n text, each containing 32 Hipster words

Example
Global.Seed(42)
fmt.Println(Global.HipsterParagraphAvg())
Output:

Gastropub five dollar toast mumblecore kinfolk loko bushwick semiotics pickled tote bag neutra loko tote bag +1 salvia organic umami polaroid synth. Wolf roof PBR&B asymmetrical craft beer taxidermy everyday venmo shabby chic art party marfa flexitarian intelligentsia mumblecore lumbersexual occupy roof you probably haven't heard of them.
Kitsch wayfarers hashtag pitchfork shabby chic echo cronut gentrify wolf jean shorts pabst normcore XOXO DIY 3 wolf moon plaid roof fanny pack. Thundercats typewriter deep v literally lo-fi cardigan hammock umami keytar polaroid schlitz yr YOLO sriracha small batch neutra truffaut sustainable.
Slow-carb fanny pack neutra wayfarers helvetica polaroid vinegar biodiesel chambray street meh cleanse drinking cliche blog pickled kale chips meggings. Selvage tattooed squid Wes Anderson fanny pack hoodie tofu yr sustainable chillwave slow-carb beard gluten-free carry stumptown hoodie actually williamsburg.
Fanny pack austin ethical portland church-key narwhal next level cleanse distillery mixtape deep v humblebrag umami gentrify kogi distillery art party Yuccie. Gentrify tumblr Yuccie VHS humblebrag swag franzen direct trade squid venmo post-ironic chillwave direct trade ethical meh vice post-ironic gentrify.

func (*Faker) HipsterSentence

func (f *Faker) HipsterSentence(wordCount int) string

HipsterSentence will generate a random sentence

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

Microdosing roof chia echo pickled.

func (*Faker) HipsterSentenceAvg

func (f *Faker) HipsterSentenceAvg() string

HipsterSentenceAvg will generate a random sentence containing 18 Hipster words.

Example
Global.Seed(42)
fmt.Println(Global.HipsterSentenceAvg())
Output:

Gastropub five dollar toast mumblecore kinfolk loko bushwick semiotics pickled tote bag neutra loko tote bag +1 salvia organic umami polaroid synth.

func (*Faker) HipsterWord

func (f *Faker) HipsterWord() string

HipsterWord will return a single hipster word

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

microdosing

func (*Faker) Hour

func (f *Faker) Hour() int

Hour will generate a random hour - in military time

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

0

func (*Faker) IPv4Address

func (f *Faker) IPv4Address() string

IPv4Address will generate a random version 4 ip address

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

222.83.191.222

func (*Faker) IPv6Address

func (f *Faker) IPv6Address() string

IPv6Address will generate a random version 6 ip address

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

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

func (*Faker) ImageURL

func (f *Faker) ImageURL(width int, height int) string

ImageURL will generate a random Image Based Upon Height And Width. Images Provided by pipsum.com/

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

http://pipsum.com/640x480.jpg

func (*Faker) Job

func (f *Faker) Job() *JobInfo

Job will generate a struct with random job information

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

Moen, Pagac and Wuckert
Developer
National
Integration

func (*Faker) JobDescriptor

func (f *Faker) JobDescriptor() string

JobDescriptor will generate a random job descriptor string

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

Central

func (*Faker) JobLevel

func (f *Faker) JobLevel() string

JobLevel will generate a random job level string

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

Assurance

func (*Faker) JobTitle

func (f *Faker) JobTitle() string

JobTitle will generate a random job title string

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

Director

func (*Faker) Language

func (f *Faker) Language() string

Language will return a random language

func (*Faker) LanguageAbbreviation

func (f *Faker) LanguageAbbreviation() string

LanguageAbbreviation will return a random language abbreviation

func (*Faker) LastName

func (f *Faker) LastName() string

LastName will generate a random last name

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

Daniel

func (*Faker) Latitude

func (f *Faker) Latitude() float64

Latitude will generate a random latitude float64

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

-73.53405629980608

func (*Faker) LatitudeInRange

func (f *Faker) LatitudeInRange(min, max float64) (float64, error)

LatitudeInRange will generate a random latitude within the input range

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

22.921026765022624

func (*Faker) Letter

func (f *Faker) Letter() string

Letter will generate a single random lower case ASCII letter

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

g

func (*Faker) Lexify

func (f *Faker) Lexify(str string) string

Lexify will replace ? will random generated letters

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

gbrma

func (*Faker) LogLevel

func (f *Faker) LogLevel(logType string) string

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

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

error
debug
trace1-8

func (*Faker) Longitude

func (f *Faker) Longitude() float64

Longitude will generate a random longitude float64

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

-147.06811259961216

func (*Faker) LongitudeInRange

func (f *Faker) LongitudeInRange(min, max float64) (float64, error)

LongitudeInRange will generate a random longitude within the input range

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

-8.170450699978453

func (*Faker) MD5

func (f *Faker) MD5() string
Example
Global.Seed(11)
fmt.Println(Global.MD5())
Output:

605410f97df9dc83d1e469fb3ee96119

func (*Faker) MacAddress

func (f *Faker) MacAddress() string

MacAddress will generate a random mac address

func (*Faker) Map

func (f *Faker) Map() map[string]interface{}

Map will generate a random set of map data

func (*Faker) MimeType

func (f *Faker) MimeType() string

MimeType will generate a random mime file type

Example
Global.Seed(11)
fmt.Println(Global.MimeType())
Output:

application/dsptype

func (*Faker) Minute

func (f *Faker) Minute() int

Minute will generate a random minute

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

0

func (*Faker) Month

func (f *Faker) Month() string

Month will generate a random month string in English (January, February ...)

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

January

func (*Faker) Name

func (f *Faker) Name() string

Name will generate a random First and Last Name

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

Markus Moen

func (*Faker) NamePrefix

func (f *Faker) NamePrefix() string

NamePrefix will generate a random name prefix

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

Mr.

func (*Faker) NameSuffix

func (f *Faker) NameSuffix() string

NameSuffix will generate a random name suffix

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

Jr.

func (*Faker) NanoSecond

func (f *Faker) NanoSecond() int

NanoSecond will generate a random nano second

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

196446360

func (*Faker) Numerify

func (f *Faker) Numerify(str string) string

Numerify will replace # with random numerical values (0-9 digits)

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

013-645-9948

func (*Faker) OperaUserAgent

func (f *Faker) OperaUserAgent() string

OperaUserAgent will generate a random opera browser user agent string

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

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

func (*Faker) Paragraph

func (f *Faker) Paragraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string

Paragraph will generate a random paragraph, similar with Lorem Lipsum. Set Paragraph Count Set Sentence Count Set Word Count Set Paragraph Separator

Example
Global.Seed(11)
fmt.Println(Global.Paragraph(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 (*Faker) ParagraphAvg

func (f *Faker) ParagraphAvg() string

ParagraphAvg will generate a 4 paragraph separated by Unix new line \n text, each containing 32 words, similar with Lorem Lipsum.

Example
Global.Seed(42)
fmt.Println(Global.ParagraphAvg())
Output:

At illum ut est sit soluta nulla numquam nobis sunt quaerat ea dolores facere deleniti culpa numquam ut. Distinctio maxime consequatur est qui corporis sunt officia odit et quia odit molestias voluptas porro repellendus magnam ipsa.
Corporis eos rem non hic esse optio quisquam hic natus earum molestias iste architecto porro et blanditiis iste. Eum repellendus nostrum qui eius suscipit fugit quia quo et nesciunt quod fuga ut vel pariatur libero sequi.
Rerum omnis soluta facilis voluptatem possimus et voluptas eaque possimus harum voluptatibus aperiam voluptatibus qui autem quam veniam. Ea voluptas facilis est autem illum esse amet in id doloribus ab architecto hic at aut aliquam impedit.
Id unde et porro est repudiandae omnis beatae iusto pariatur quia sed laboriosam voluptate earum dolores facilis aspernatur. Quam aperiam et nihil explicabo voluptates officia ad porro animi officiis et quam in voluptatem eveniet temporibus fuga.

func (*Faker) Password

func (f *Faker) 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
Global.Seed(11)
fmt.Println(Global.Password(true, false, false, false, false, 32))
fmt.Println(Global.Password(false, true, false, false, false, 32))
fmt.Println(Global.Password(false, false, true, false, false, 32))
fmt.Println(Global.Password(false, false, false, true, false, 32))
fmt.Println(Global.Password(true, true, true, true, true, 32))
fmt.Println(Global.Password(true, true, true, true, true, 4))
Output:

vodnqxzsuptgehrzylximvylxzoywexw
ZSRQWJFJWCSTVGXKYKWMLIAFGFELFJRG
61718615932495608398906260648432
@=-%%#$=-%+++&-#?*&?%&=%?+#@@-&?
EEP+wwpk 4lU-eHNXlJZ4n K9%v&TZ9e
j ?9X

func (*Faker) PasswordFull

func (f *Faker) PasswordFull() string

PasswordFull will generate a random password of length 12 that contains at least 1 digit, 1 special character, 1 Lower and 1 Upper case letters.

Example
Global.Seed(42)
fmt.Println(Global.PasswordFull())
Output:

e+Hea2n9Xw0Q

func (*Faker) Person

func (f *Faker) Person() *PersonInfo

Person will generate a struct with person information

Example
Global.Seed(11)
person := Global.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
http://pipsum.com/80x80.jpg
Lockman and Sons
Developer
Global
Brand
5369 Streamville, Rossieview, Hawaii 42591
5369 Streamville
Rossieview
Hawaii
42591
Burkina Faso
-6.662594491850811
23.921575244414612
9676941592
christyratke@stracke.org
Visa
4027613217148008
11/29
982

func (*Faker) Phone

func (f *Faker) Phone() string

Phone will generate a 10 digit random phone number string

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

7787046119

func (*Faker) PhoneFormatted

func (f *Faker) PhoneFormatted() string

PhoneFormatted will generate a random phone number string

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

136-459-9489

func (*Faker) Price

func (f *Faker) Price(min, max float64) float64

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

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

92.26

func (*Faker) ProgrammingLanguage

func (f *Faker) ProgrammingLanguage() string

ProgrammingLanguage will return a random programming language

func (*Faker) Question

func (f *Faker) Question() string

Question will return a random question

func (*Faker) Quote

func (f *Faker) Quote() string

Quote will return a random quote from a random person

func (*Faker) RGBColor

func (f *Faker) RGBColor() []int

RGBColor will generate a random int slice color

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

[152 23 53]

func (*Faker) RandString

func (f *Faker) RandString(a []string) string

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

func (*Faker) SHA256

func (f *Faker) SHA256() string
Example
Global.Seed(11)
fmt.Println(Global.SHA256())
Output:

e33789b87c2858fbfece97c81533b496493700ff3845d3f80e413ab588859dff

func (*Faker) SSN

func (f *Faker) SSN() string

SSN will generate a random Social Security Number

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

296446360

func (*Faker) SafariUserAgent

func (f *Faker) SafariUserAgent() string

SafariUserAgent will generate a random safari browser user agent string

Example
Global.Seed(11)
fmt.Println(Global.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 (*Faker) SafeColor

func (f *Faker) SafeColor() string

SafeColor will generate a random safe color string

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

black

func (*Faker) Second

func (f *Faker) Second() int

Second will generate a random second

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

0

func (*Faker) Sentence

func (f *Faker) Sentence(wordCount int) string

Sentence will generate a random sentence, similar with Lorem Lipsum.

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

Quia quae repellat consequatur quidem.

func (*Faker) SentenceAvg

func (f *Faker) SentenceAvg() string

SentenceAvg will generate a 18 word sentence, similar with Lorem Lipsum.

Example
Global.Seed(42)
fmt.Println(Global.SentenceAvg())
Output:

At illum ut est sit soluta nulla numquam nobis sunt quaerat ea dolores facere deleniti culpa numquam ut.

func (*Faker) ShuffleStrings

func (f *Faker) ShuffleStrings(a []string)

ShuffleStrings will randomize a slice of strings

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

[good everyone have for times a day happy]

func (*Faker) SimpleStatusCode

func (f *Faker) SimpleStatusCode() int

SimpleStatusCode will generate a random simple status code

Example
Global.Seed(11)
fmt.Println(Global.SimpleStatusCode())
Output:

200

func (*Faker) SliceStrings

func (f *Faker) SliceStrings() []string

func (*Faker) State

func (f *Faker) State() string

State will generate a random state string

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

Hawaii

func (*Faker) StateAbr

func (f *Faker) StateAbr() string

StateAbr will generate a random abbreviated state string

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

OR

func (*Faker) StatusCode

func (f *Faker) StatusCode() int

StatusCode will generate a random status code

Example
Global.Seed(11)
fmt.Println(Global.StatusCode())
Output:

404

func (*Faker) Street

func (f *Faker) Street() (street string)

Street will generate a random address street string

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

364 East Rapidsborough

func (*Faker) StreetName

func (f *Faker) StreetName() string

StreetName will generate a random address street name string

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

View

func (*Faker) StreetNumber

func (f *Faker) StreetNumber() string

StreetNumber will generate a random address street number string

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

13645

func (*Faker) StreetPrefix

func (f *Faker) StreetPrefix() string

StreetPrefix will generate a random address street prefix string

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

Lake

func (*Faker) StreetSuffix

func (f *Faker) StreetSuffix() string

StreetSuffix will generate a random address street suffix string

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

land

func (*Faker) Struct

func (f *Faker) 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. Attention: Because it uses reflection it has a performance penalty!

Example
Global.Seed(42)
type Foo struct {
	//for all the possible template variables see TEMPLATE_VARIABLES.md
	Browser string `fake:"{browser}"`
	Drink   string `fake:"{beername}"`
	Phone   string `fake:"##-###-###"`
	Blob    string `fake:"?????"`
	Int     int
	Dice    uint8
	Pointer *int
	Skip    *string `fake:"skip"`
}
var f Foo
Global.Struct(&f)
fmt.Printf("%s\n", f.Browser)
fmt.Printf("%s\n", f.Drink)
fmt.Printf("%s\n", f.Phone)
fmt.Printf("%s\n", f.Blob)
fmt.Printf("%d\n", f.Int)
fmt.Printf("%d\n", f.Dice)
fmt.Printf("%d\n", *f.Pointer)
fmt.Printf("%v\n", f.Skip)
Output:

firefox
Samuel Smith’s Oatmeal Stout
80-357-683
ptneu
-4923402592883905764
4
-2620303913143990366
<nil>

func (*Faker) Template

func (f *Faker) Template(pattern string) string

Template replaces all the found variables into the template with the actual results from the Faker.*() function.

fastFaker.Template("Hello {name}!") //Hello Jeromy Schmeler!

All the "#" will be replaced by a digit and all the "?" by a ASCII letter.

To use custom delimiters (instead of {}) see TemplateCustom() For more details and examples see TEMPLATES.md

Example
template := "Hello {name}!"

fastFaker := NewFastFaker() // not concurrent safe, see NewSafeFaker()
fastFaker.Seed(42)          //for each seed value will generate a different result

fmt.Printf("%s\n", fastFaker.Template(template))
fmt.Printf("%s\n", fastFaker.Template(template))
Output:

Hello Jeromy Schmeler!
Hello Kim Steuber!
Example (Html)
template := `<ul class="person">
	<li>Name: {name}</li>
	<li>Age: ##</li>
	<li>Number: {phone}</li>
	<li>Address: {street}, {city} {country}</li>
</ul>`

fastFaker := NewFastFaker() // not concurrent safe, see NewSafeFaker()
fastFaker.Seed(42)          //for each seed value will generate a different result

fmt.Printf("%s\n", fastFaker.Template(template))
Output:

<ul class="person">
	<li>Name: Kim Steuber</li>
	<li>Age: 57</li>
	<li>Number: 9788453650</li>
	<li>Address: 68397 Rueshire, Port Adams Central African Republic</li>
</ul>
Example (Json)
template := `{name:"{name}", age: {digit}, confirmed: {booltext}}`

fastFaker := NewFastFaker() // not concurrent safe, see NewSafeFaker()
fastFaker.Seed(42)          //for each seed value will generate a different result

fmt.Printf("%s\n", fastFaker.Template(template))
Output:

{name:"Jeromy Schmeler", age: 8, confirmed: false}
Example (Yaml)
template := `
invoice: ######
date: {year}-{month}-{day}
bill-to: {username}
	given: {name}
	city: {city}
	state: {state}
	postal: {zip}
product:
	-	sku: ??###?
		quantity: {uint8}
		description: {word}
		price: {uint8}.##
tax: {uint8}.##
total: {uint16}.##`

fastFaker := NewFastFaker() // not concurrent safe, see NewSafeFaker()
fastFaker.Seed(42)          //for each seed value will generate a different result

fmt.Printf("%s\n", fastFaker.Template(template))
Output:

invoice: 578035
date: 1995-September-2
bill-to: Little4541
	given: Lilly McClure
	city: Pacochaport
	state: Arizona
	postal: 09847
product:
	-	sku: vu768n
		quantity: 28
		description: non
		price: 75.39
tax: 235.75
total: 61792.82

func (*Faker) TemplateCustom

func (f *Faker) TemplateCustom(template, delimStart, delimEnd string) (string, error)

TemplateCustom replaces all the found variables into the template with the actual results from the Faker.*() function.

fastFaker.Template("Hello {name}!") //Hello Jeromy Schmeler!

It needs a start and end variable delimiters (delimStart, delimEnd). They can only contain runes from TemplateAllowedDelimiters. There is no constraint on the number of characters. Examples of valid delimiters: {{name}}, %%%name%%% or mixed: <<%name>>

It uses Regex to find all the variables.

func (*Faker) TimeZone

func (f *Faker) TimeZone() string

TimeZone will select a random timezone string

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

Kaliningrad Standard Time

func (*Faker) TimeZoneAbv

func (f *Faker) TimeZoneAbv() string

TimeZoneAbv will select a random timezone abbreviation string

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

KST

func (*Faker) TimeZoneFull

func (f *Faker) TimeZoneFull() string

TimeZoneFull will select a random full timezone string

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

(UTC+03:00) Kaliningrad, Minsk

func (*Faker) TimeZoneOffset

func (f *Faker) TimeZoneOffset() float32

TimeZoneOffset will select a random timezone offset

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

3

func (*Faker) TransmissionGearType

func (f *Faker) TransmissionGearType() string

TransmissionGearType will generate a random transmission type

Example
Global.Seed(11)
fmt.Println(Global.TransmissionGearType())
Output:

Manual

func (*Faker) URL

func (f *Faker) URL() string

URL will generate a random url string

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

https://www.nationalseamless.net/iterate/streamline/systems

func (*Faker) UUID

func (f *Faker) UUID() string

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

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

590c1440-9888-45b0-bd51-a817ee07c3f2

func (*Faker) UserAgent

func (f *Faker) UserAgent() string

UserAgent will generate a random browser user agent

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

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

func (*Faker) Username

func (f *Faker) Username() string

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

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

Daniel1364

func (*Faker) Vehicle

func (f *Faker) Vehicle() *VehicleInfo

Vehicle will generate a struct with vehicle information

Example
Global.Seed(11)
vehicle := Global.Vehicle()
fmt.Println(vehicle.Brand)
fmt.Println(vehicle.Fuel)
fmt.Println(vehicle.Model)
fmt.Println(vehicle.TransmissionGear)
fmt.Println(vehicle.VehicleType)
fmt.Println(vehicle.Year)
Output:

Fiat
Gasoline
Freestyle Fwd
Automatic
Passenger car mini
1925

func (*Faker) VehicleType

func (f *Faker) VehicleType() string

VehicleType will generate a random vehicle type string

Example
Global.Seed(11)
fmt.Println(Global.VehicleType())
Output:

Passenger car mini

func (*Faker) WeekDay

func (f *Faker) WeekDay() string

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

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

Friday

func (*Faker) Word

func (f *Faker) Word() string

Word will generate a random word

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

quia

func (*Faker) Year

func (f *Faker) Year() int

Year will generate a random year between 1900 - current year

Example
Global.Seed(13)
fmt.Println(Global.Year())
Output:

2012

func (*Faker) Zip

func (f *Faker) Zip() string

Zip will generate a random Zip code string

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

13645

type JobInfo

type JobInfo struct {
	Company    string
	Title      string
	Descriptor string
	Level      string
}

JobInfo is a struct of job information

type PersonInfo

type PersonInfo struct {
	FirstName  string
	LastName   string
	Gender     string
	SSN        string
	Image      string
	Job        *JobInfo
	Address    *AddressInfo
	Contact    *ContactInfo
	CreditCard *CreditCardInfo
}

PersonInfo is a struct of person information

type VehicleInfo

type VehicleInfo struct {
	// Vehicle type
	VehicleType string
	// Fuel type
	Fuel string
	// Transmission type
	TransmissionGear string
	// Brand name
	Brand string
	// Vehicle model
	Model string
	// Vehicle model year
	Year int
}

VehicleInfo contains all the major features of a motorized vehicle

Jump to

Keyboard shortcuts

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