faker
faker copied to clipboard
Support inter-field dependencies
Consider the following struct
type Entry struct {
Bananas []int
BananasCount int
}
The field BananasCount must be consistent with len(Entry.Bananas)
How can one create this kind of fake instance of Entry using faker?
I think It's still do-able. But, if it's possible I prefer to make it as a custom faker function that you can register by your self to faker.
I still didn't found this will be very useful to a lot of people. I will keep this issue open, if in the future there's a lot of requesting the same features, we will re-consider to move it as the main function.
How about that?
@bxcodec I have a similar use-case, say FooId
and BarId
, and would like to generate a random string for either of them but not for both of them at the same time; could you give an example of how could I make a custom faker function for that?