All Projects → bxcodec → Faker

bxcodec / Faker

Licence: mit
Go (Golang) Fake Data Generator for Struct

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Faker

miz
🎯 Generate fake data, Just like a person.
Stars: ✭ 24 (-98.59%)
Mutual labels:  faker, mock-data, fake-data
Faker
Faker is a pure Elixir library for generating fake data.
Stars: ✭ 673 (-60.37%)
Mutual labels:  faker, generator, testing-tools
fakerfactory
伪造数据的API服务
Stars: ✭ 53 (-96.88%)
Mutual labels:  testing-tools, mock-data, fake-data
Beanmother
A library for setting up Java objects as test data.
Stars: ✭ 102 (-93.99%)
Mutual labels:  faker, testing-tools
tree-json-generator
Simple JavaScript Tree Generator library
Stars: ✭ 13 (-99.23%)
Mutual labels:  mock-data, fake-data
faker
Faker is a Nim package that generates fake data for you.
Stars: ✭ 28 (-98.35%)
Mutual labels:  generator, faker
random
Random data generator AKA faker
Stars: ✭ 14 (-99.18%)
Mutual labels:  faker, fake-data
Fako
Struct Faker for Go
Stars: ✭ 329 (-80.62%)
Mutual labels:  struct, faker
goverter
Generate type-safe Go converters by simply defining an interface
Stars: ✭ 100 (-94.11%)
Mutual labels:  generator, struct
Bogus
📇 A simple and sane fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Stars: ✭ 5,083 (+199.35%)
Mutual labels:  faker, generator
Flog
🎩 A fake log generator for common log formats
Stars: ✭ 531 (-68.73%)
Mutual labels:  faker, generator
Go Envparser
a go generator based env to go-struct decoder.
Stars: ✭ 17 (-99%)
Mutual labels:  struct, generator
dummy-products-api
An api to fetch dummy e-commerce product 👕 👗 👖 👚 JSON data with placeholder images.
Stars: ✭ 102 (-93.99%)
Mutual labels:  dummy-data, fake-data
MockDataGenerator
Generate mock data for POCO
Stars: ✭ 12 (-99.29%)
Mutual labels:  testing-tools, mock-data
faker
A set of javascript packages that generates fake data for you.
Stars: ✭ 33 (-98.06%)
Mutual labels:  faker, fake-data
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+102.53%)
Mutual labels:  faker, generator
mysql-random-data-generator
This is the easiest MySQL random test data generator tool. Load the procedure and execute to auto detect column types and load data.
Stars: ✭ 108 (-93.64%)
Mutual labels:  dummy-data, dummy-data-generator
Pytest Mimesis
Mimesis integration with the pytest test runner. This plugin provider useful fixtures based on providers from Mimesis.
Stars: ✭ 46 (-97.29%)
Mutual labels:  faker, testing-tools
Coolie
Coolie(苦力) helps you to create models (& their constructors) from a JSON file.
Stars: ✭ 508 (-70.08%)
Mutual labels:  struct, generator
Faker.js
generate massive amounts of realistic fake data in Node.js and the browser
Stars: ✭ 34,329 (+1921.73%)
Mutual labels:  faker, fake-data

Docs

faker

Struct Data Fake Generator

Faker will generate you a fake data based on your Struct.

Build Status codecov Go Report Card License GoDoc Go.Dev

Index

Support

You can file an Issue. See documentation in Godoc or in Go.Dev

Getting Started

Download

go get -u github.com/bxcodec/faker/v3

Example


DEMO


Example to use Faker

Benchmark


Bench To Generate Fake Data

Without Tag

BenchmarkFakerDataNOTTagged-4             500000              3049 ns/op             488 B/op         20 allocs/op

Using Tag

 BenchmarkFakerDataTagged-4                100000             17470 ns/op             380 B/op         26 allocs/op

MUST KNOW


The Struct Field must be PUBLIC.
Support Only For :

  • int, int8, int16, int32 & int64
  • []int, []int8, []int16, []int32 & []int64
  • bool & []bool
  • string & []string
  • float32, float64, []float32 &[]float64
  • time.Time & []time.Time
  • Nested Struct Field

Limitation


Unfortunately this library has some limitation

  • It does not support private fields. Make sure your structs fields you intend to generate fake data for are public, it would otherwise trigger a panic. You can however omit fields using a tag skip faker:"-" on your private fields.
  • It does not support the interface{} data type. How could we generate anything without knowing its data type?
  • It does not support the map[interface{}]interface{}, map[any_type]interface{} & map[interface{}]any_type data types. Once again, we cannot generate values for an unknown data type.
  • Custom types are not fully supported. However some custom types are already supported: we are still investigating how to do this the correct way. For now, if you use faker, it's safer not to use any custom types in order to avoid panics.
  • Some extra custom types can be supported IF AND ONLY IF extended with AddProvider() please see example
  • The oneof tag currently only supports string, the int types, and both float32 & float64. Further support is coming soon (i.e. hex numbers, etc). See example for usage.

Contribution


To contrib to this project, you can open a PR or an issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].