Go (Golang) Fake Data Generator for Struct. [Notes]This repository is archived, moved to the new repository https://github.com/go-faker/faker
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
chore: add sponsor button | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: implement v3 style option function (#173) * feat: implement v3 style option function * feat: make global settings concurrent safe Co-authored-by: Iman Tumorang <iman@tumorang.com> | 3 年前 | |
Optionally insert nils instead of empty slices and maps (#59) * While fakedata is generating, maps and slices can be nil. According to flag. | 7 年前 | |
fix: linter, gomod version, tests (#167) * fix: linter, upgrade Go version * chore: fix test * chore: remove unused comment | 3 年前 | |
chore(go): update go version for testing in travis (#85) | 6 年前 | |
Initial commit | 9 年前 | |
fix: linter, gomod version, tests (#167) * fix: linter, upgrade Go version * chore: fix test * chore: remove unused comment | 3 年前 | |
Update README.md | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
chore: resolve go-dev runnable example (#174) | 3 年前 | |
chore: resolve go-dev runnable example (#174) | 3 年前 | |
chore: resolve go-dev runnable example (#174) | 3 年前 | |
chore: resolve go-dev runnable example (#174) | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: implement v3 style option function (#173) * feat: implement v3 style option function * feat: make global settings concurrent safe Co-authored-by: Iman Tumorang <iman@tumorang.com> | 3 年前 | |
feat: implement v3 style option function (#173) * feat: implement v3 style option function * feat: make global settings concurrent safe Co-authored-by: Iman Tumorang <iman@tumorang.com> | 3 年前 | |
chore: add deprecation message for go.mod | 3 年前 | |
fix: linter, gomod version, tests (#167) * fix: linter, upgrade Go version * chore: fix test * chore: remove unused comment | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: implement v3 style option function (#173) * feat: implement v3 style option function * feat: make global settings concurrent safe Co-authored-by: Iman Tumorang <iman@tumorang.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: added random source customization (#137) * added random source customization Signed-off-by: Frederic BIDON <fredbi@yahoo.com> * added unit tests Signed-off-by: Frederic BIDON <fredbi@yahoo.com> | 5 年前 | |
feat: added random source customization (#137) * added random source customization Signed-off-by: Frederic BIDON <fredbi@yahoo.com> * added unit tests Signed-off-by: Frederic BIDON <fredbi@yahoo.com> | 5 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat: add v4 initial version, with options and restructured package (#169) * feat: add v4 initial version, with options and restructured package * fix: move max slice to option * fix: move min slice to option * fix: move max str generation to option * fix: set nil if len zero to option * fix: set random len zero to option * chore: move integer boundary to option * fix: move random float to option * fix: add integer boundaries to option * chore: resolve linter * feat: update WithRecursionMaxDepth & unittest (#171) * feat: update WithRecursionMaxDepth & unittest * style: remove unnecessary check * chore: use variadic function for options * chore: move to pkg directory * fix: slice_len (#172) * chore: update readme Co-authored-by: OrangeWolf <orange_wolf@163.com> | 3 年前 | |
feat(faker): open the faker core function to be able accessed from external project (#63) * feat(faker): open the faker core function to fake data accessed from the external project | 7 年前 |
以下内容由 AI 翻译,如有问题请 点此提交 issue 反馈
重要提示
此存储库已被归档,并移至新的仓库:https://github.com/go-faker/faker 后续的开发和修复将在新仓库中进行。
文档
faker
结构体数据伪造生成器
Faker 将基于您的结构体生成假数据。
目录
支持
您可以通过创建 问题 提出问题。 查看 Go.dev 文档 获取更多信息。
开始使用
下载
go get -u github.com/bxcodec/faker/v4
示例
- 使用结构体标记:
- 自定义结构体标记(定义自己的伪造数据):example_custom_faker_test.go
- 不使用结构体标记:example_without_tag_test.go
- 单个伪造数据函数:example_single_fake_data_test.go
演示

性能基准测试
生成假数据的基准测试:
不带标记
BenchmarkFakerDataNOTTagged-4 500000 3049 ns/op 488 B/op 20 allocs/op
使用标记
BenchmarkFakerDataTagged-4 100000 17470 ns/op 380 B/op 26 allocs/op
必须知道
结构体字段必须是公共的。
仅支持以下类型:
int,int8,int16,int32和int64[]int,[]int8,[]int16,[]int32和[]int64bool和[]boolstring和[]stringfloat32,float64,[]float32和[]float64time.Time和[]time.Time- 嵌套的结构体字段
限制
不幸的是,这个库存在一些限制:
- 不支持私有字段。确保您打算为其生成假数据的结构体字段是公共的,否则会触发恐慌。不过,您可以使用标记
faker:"-"跳过私有字段。 - 不支持 `interface
项目介绍
Go(Golang)结构体伪造数据生成器。[说明]此代码库已归档,已迁移至新的代码库 https://github.com/go-faker/faker【此简介由AI生成】
MIT Go136提交数dummy-datadummy-data-generatorfake-datafakergeneratorgogolanghactoberfestmock-datastructtesting-tools
定制我的领域