Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Support inter-field dependencies #84

Open
asilverman opened this issue Dec 19, 2019 · 2 comments
Open

Support inter-field dependencies #84

asilverman opened this issue Dec 19, 2019 · 2 comments

Comments

@asilverman
Copy link

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?

@bxcodec
Copy link
Owner

bxcodec commented Jan 28, 2020

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?

@filipegorges
Copy link

@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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants