This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 148
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Any updates on this PR @System-Glitch |
@bxcodec Well I was waiting for feedback on the single fake data functions before continuing. Does this look ok for you? I feel like it's far from optimal. |
if generateUniqueValues {
v, err := generateUnique(PARAGRAPH, func() interface{} {
return i.paragraph()
})
if err != nil {
panic(err)
}
return v.(string)
} This part is redundant. It has to be there for every single fake data function. Maybe you have an idea to make it better? I though about another function to factor this. func singleFakeData(dataType string, fn func() interface{}) interface{} {
if generateUniqueValues {
v, err := generateUnique(dataType, fn)
if err != nil {
panic(err)
}
return v
}
return fn()
} That would shorten a single fake data function to this. func Word() string {
i := Lorem{}
return singleFakeData(WORD, func() interface{} {
return i.word()
}).(string)
} |
@bxcodec PR is ready to be merged. |
bxcodec
approved these changes
Nov 15, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the PR @System-Glitch 👍 |
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refer to issue #76
unique
tag to generate unique data.ResetUnique()
after generating a dataset to forget all already generated valuesLorem
generator as a proposal for the single fake data functions. My implementation is redundant. Any feedback would be appreciated before implementing it to the other single fake data functions.SetGenerateUniqueValues(true)
to enable unique data generation on single fake data functionsSetGenerateUniqueValues(false)
to disable itResetUnique()
to forget all already generated valuesThis change shouldn't break backwards compatibility.
TODO: