faker

package module
v0.0.0-...-9fbc68a Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: MIT Imports: 11 Imported by: 154 modules, 153 packages

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

README

Faker for Go

build status

Usage

package main

import (
  "github.com/manveru/faker"
)

func main() {
  fake, err := faker.New("en")
  if err != nil {
    panic(err)
  }
  println(fake.Name())  //> "Adriana Crona"
  println(fake.Email()) //> charity.brown@fritschbotsford.biz
}

Inspired by the ruby faker gem, which is a port of the Perl Data::Faker library.

Documentation

Overview

faker generates fake data in various languages.

Index

Examples

Constants

This section is empty.

Variables

View Source
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",
}

Functions

This section is empty.

Types

type Faker

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

func New

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

func (*Faker) CellPhoneNumber

func (f *Faker) CellPhoneNumber() string

func (*Faker) Characters

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

func (*Faker) City

func (f *Faker) City() string

func (*Faker) CityPrefix

func (f *Faker) CityPrefix() string

func (*Faker) CitySuffix

func (f *Faker) CitySuffix() string

func (*Faker) CompanyBs

func (f *Faker) CompanyBs() string

func (*Faker) CompanyCatchPhrase

func (f *Faker) CompanyCatchPhrase() string

func (*Faker) CompanyName

func (f *Faker) CompanyName() string

func (*Faker) CompanySuffix

func (f *Faker) CompanySuffix() string

func (*Faker) Country

func (f *Faker) Country() string

func (*Faker) DomainName

func (f *Faker) DomainName() string

func (*Faker) DomainSuffix

func (f *Faker) DomainSuffix() string

func (*Faker) DomainWord

func (f *Faker) DomainWord() string

func (*Faker) Email

func (f *Faker) Email() string

func (*Faker) FirstName

func (f *Faker) FirstName() string

func (*Faker) FreeEmail

func (f *Faker) FreeEmail() string

func (*Faker) IPv4Address

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

func (*Faker) IPv6Address

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

func (*Faker) JobTitle

func (f *Faker) JobTitle() string

func (*Faker) LastName

func (f *Faker) LastName() string

func (*Faker) Latitude

func (f *Faker) Latitude() float64

func (*Faker) Longitude

func (f *Faker) Longitude() float64

func (*Faker) Name

func (f *Faker) Name() string

Name returns a random personal name in various formats.

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

func (*Faker) NamePrefix

func (f *Faker) NamePrefix() string

func (*Faker) NameSuffix

func (f *Faker) NameSuffix() string

func (*Faker) Paragraph

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

func (*Faker) Paragraphs

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

func (*Faker) PhoneNumber

func (f *Faker) PhoneNumber() string

func (*Faker) PostCode

func (f *Faker) PostCode() string

func (*Faker) SafeEmail

func (f *Faker) SafeEmail() string

func (*Faker) SecondaryAddress

func (f *Faker) SecondaryAddress() string

func (*Faker) Sentence

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

func (*Faker) Sentences

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

func (*Faker) State

func (f *Faker) State() string

func (*Faker) StateAbbr

func (f *Faker) StateAbbr() string

func (*Faker) StreetAddress

func (f *Faker) StreetAddress() string

func (*Faker) StreetName

func (f *Faker) StreetName() string

func (*Faker) StreetSuffix

func (f *Faker) StreetSuffix() string

func (*Faker) URL

func (f *Faker) URL() string

func (*Faker) UserName

func (f *Faker) UserName() string

func (*Faker) Words

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

type Rand

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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