jun 2017dic 2018jun 2020dic 2021jul 2023ene 2025jul 2026
ArtefactosGo Modulesgo get github.com/bxcodec/faker
README
Important Notes
This repository has been archived, and moved to the new repository here https://github.com/go-faker/faker
Further development and fixing will be happening in the new repository.
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.