faker

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasLocale added in v2.7.0

func HasLocale(locale string) bool

HasLocale reports whether data is currently set for locale. Transforms for a locale without data fall back to the default one.

func SetLocaleData added in v2.7.0

func SetLocaleData(locale string, data LocaleData) error

SetLocaleData adds a locale or replaces an existing one, including the built-in ones. It is safe to call while transforms are running. Fakers that already resolved an unknown locale to the default one keep using the default.

func TransformBusinessId added in v2.2.0

func TransformBusinessId(input string, locale string) string

func TransformCity

func TransformCity(input string, locale string) string

func TransformCompanyName

func TransformCompanyName(input string, locale string) string

func TransformFirstName

func TransformFirstName(input string, locale string) string

func TransformFullName

func TransformFullName(input string, locale string) string

func TransformLastName

func TransformLastName(input string, locale string) string

func TransformStreet

func TransformStreet(input string, locale string) string

Types

type Faker

type Faker struct {
	Locale string
}

func NewWithLocale added in v2.1.0

func NewWithLocale(locale string) *Faker

NewWithLocale keeps locale even when it has no data yet, so it can be set later with SetLocaleData; until then transforms use the default locale.

func (*Faker) FuncMap

func (f *Faker) FuncMap() template.FuncMap

type LocaleData added in v2.7.0

type LocaleData struct {
	FirstNames       []string `json:"firstNames"`
	LastNames        []string `json:"lastNames"`
	StreetNames      []string `json:"streetNames"`
	Cities           []string `json:"cityNames"`
	Companies        []string `json:"companies"`
	CompanySuffixes  []string `json:"companySuffixes"`
	BusinessIdFormat string   `json:"businessIdFormat"`
}

Jump to

Keyboard shortcuts

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