faker: github.com/manveru/faker Index | Examples | Files | Directories

package faker

import "github.com/manveru/faker"

faker generates fake data in various languages.

Index

Examples

Package Files

dict.go faker.go

Variables

var Dict = dict

You can add your own translations and words to this dictionary. It's a map[string]map[string][]string. For example:

faker.Dict["en"]["company.suffix"] = []string{
  "Inc",
  "and Sons",
  "LLC",
  "Group",
}

type Faker Uses

type Faker struct {
    Language string
    Dict     map[string][]string
    Rand     Rand
    Buffer   bytes.Buffer
}

func New Uses

func New(lang string) (*Faker, error)

func (*Faker) CellPhoneNumber Uses

func (f *Faker) CellPhoneNumber() string

func (*Faker) Characters Uses

func (f *Faker) Characters(count int) string

func (*Faker) City Uses

func (f *Faker) City() string

func (*Faker) CityPrefix Uses

func (f *Faker) CityPrefix() string

func (*Faker) CitySuffix Uses

func (f *Faker) CitySuffix() string

func (*Faker) CompanyBs Uses

func (f *Faker) CompanyBs() string

func (*Faker) CompanyCatchPhrase Uses

func (f *Faker) CompanyCatchPhrase() string

func (*Faker) CompanyName Uses

func (f *Faker) CompanyName() string

func (*Faker) CompanySuffix Uses

func (f *Faker) CompanySuffix() string

func (*Faker) Country Uses

func (f *Faker) Country() string

func (*Faker) DomainName Uses

func (f *Faker) DomainName() string

func (*Faker) DomainSuffix Uses

func (f *Faker) DomainSuffix() string

func (*Faker) DomainWord Uses

func (f *Faker) DomainWord() string

func (*Faker) Email Uses

func (f *Faker) Email() string

func (*Faker) FirstName Uses

func (f *Faker) FirstName() string

func (*Faker) FreeEmail Uses

func (f *Faker) FreeEmail() string

func (*Faker) IPv4Address Uses

func (f *Faker) IPv4Address() net.IP

func (*Faker) IPv6Address Uses

func (f *Faker) IPv6Address() net.IP

func (*Faker) JobTitle Uses

func (f *Faker) JobTitle() string

func (*Faker) LastName Uses

func (f *Faker) LastName() string

func (*Faker) Latitude Uses

func (f *Faker) Latitude() float64

func (*Faker) Longitude Uses

func (f *Faker) Longitude() float64

func (*Faker) Name Uses

func (f *Faker) Name() string

Name returns a random personal name in various formats.

Code:

fake, _ := New("en")
fake.Rand = rand.New(rand.NewSource(42))
fmt.Println(fake.Name())

Output:

Adriana Crona

func (*Faker) NamePrefix Uses

func (f *Faker) NamePrefix() string

func (*Faker) NameSuffix Uses

func (f *Faker) NameSuffix() string

func (*Faker) Paragraph Uses

func (f *Faker) Paragraph(sentences int, supplemental bool) string

func (*Faker) Paragraphs Uses

func (f *Faker) Paragraphs(count int, supplemental bool) []string

func (*Faker) PhoneNumber Uses

func (f *Faker) PhoneNumber() string

func (*Faker) PostCode Uses

func (f *Faker) PostCode() string

func (*Faker) SafeEmail Uses

func (f *Faker) SafeEmail() string

func (*Faker) SecondaryAddress Uses

func (f *Faker) SecondaryAddress() string

func (*Faker) Sentence Uses

func (f *Faker) Sentence(words int, supplemental bool) string

func (*Faker) Sentences Uses

func (f *Faker) Sentences(count int, supplemental bool) []string

func (*Faker) State Uses

func (f *Faker) State() string

func (*Faker) StateAbbr Uses

func (f *Faker) StateAbbr() string

func (*Faker) StreetAddress Uses

func (f *Faker) StreetAddress() string

func (*Faker) StreetName Uses

func (f *Faker) StreetName() string

func (*Faker) StreetSuffix Uses

func (f *Faker) StreetSuffix() string

func (*Faker) URL Uses

func (f *Faker) URL() string

func (*Faker) UserName Uses

func (f *Faker) UserName() string

func (*Faker) Words Uses

func (f *Faker) Words(count int, supplemental bool) []string

type Rand Uses

type Rand interface {
    Float32() float32
    Float64() float64
    Int63n(int64) int64
    Intn(int) int
}

Directories

PathSynopsis
bin

Package faker imports 11 packages (graph) and is imported by 55 packages. Updated 2017-11-03. Refresh now. Tools for package owners.