Fill It Docs
Description
Fill It is a simple tool that allows you to fill random values for almost all Go types.
It is useful for testing and generating random data.
The package is inspired by faker.
This package provides more customization options for data generation, such as global type data providers or setting a provider for a field by its path.

Installation
go get github.com/yanodincov/fillit
Example
Types
Fully Supported Types
- bool
- int{,8,16,32,64}
- uint{,8,16,32,64}
- float{32,64}
- complex{64,128}
- string
- array
- slice
- map
- struct
- pointer
All these types, and any combinations of them, are supported, such as:
- Nested structs
- Custom types using any supported types
- Slice of structs
- Structs with circular references
Not Supported Types
- interface
- channel
- function
- uintptr
These types are not supported and will be ignored. However, you can fill interface types with this package
if you define a custom provider for them.
Benchmarks
Tested structures
type simpleTypeStruct struct {
Str string
Arr [3]int
Int int
Bol bool
}
type simpleNestedTypeStruct struct {
Map map[int]string
Slice []int
Bs1 simpleTypeStruct
}
type doubleNestedFileStruct struct {
Map map[string]simpleNestedTypeStruct
Slice []simpleNestedTypeStruct
Bs2 simpleNestedTypeStruct
}
type tripleNestedFileStruct struct {
Map map[simpleTypeStruct]doubleNestedFileStruct
Slice []doubleNestedFileStruct
Bs3 doubleNestedFileStruct
}
Results (Fill It)
BenchmarkFill/simple_type-8 397930 3032 ns/op
BenchmarkFill/simple_nested_struct-8 76544 15469 ns/op
BenchmarkFill/double_nested_struct-8 3692 325196 ns/op
BenchmarkFill/triple_nested_struct-8 168 7071680 ns/op
Results (faker) (with the same structs)
BenchmarkFakerFill/simple_type-8 167934 7109 ns/op
BenchmarkFakerFill/simple_nested_struct-8 41426 29000 ns/op
BenchmarkFakerFill/double_nested_struct-8 2096 566001 ns/op
BenchmarkFakerFill/triple_nested_struct-8 100 11944321 ns/op