Giter VIP home page Giter VIP logo

faker's Introduction

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.

Contribution


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

faker's People

Contributors

agoalofalife avatar bxcodec avatar ilackarms avatar jostillmanns avatar martinbergpetersen avatar mgrachev avatar momotaro98 avatar mrvanboy avatar msorens avatar olimpias avatar perryao avatar qjcg avatar rdelval avatar revenue-hack avatar rgaskill avatar rodnover55 avatar saturn4er avatar sebastian-walter avatar shivam010 avatar steveoc64 avatar system-glitch avatar tcr-ableton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.