-
-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add MongoDB ObjectId generation #616
Conversation
Signed-off-by: Nick Hammond <n.hammond@waracle.com>
Would this fit better into |
Signed-off-by: Nick Hammond <n.hammond@waracle.com>
Not related to this PR, but IMO we should try to prepare that the datatype module only defines functions for |
@Shinigami92 agree on the moving to database, and have done so now. Is there anything I can add to the current PR to facilitate the future |
Mh, currently I don't think so. You can always join our discord if you haven't already, so we can communicate better there. |
Codecov Report
@@ Coverage Diff @@
## main #616 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 1921 1921
Lines 176656 176667 +11
Branches 905 906 +1
=======================================
+ Hits 175503 175514 +11
Misses 1097 1097
Partials 56 56
|
Signed-off-by: Nick Hammond <n.hammond@waracle.com>
Signed-off-by: Nick Hammond <n.hammond@waracle.com>
Signed-off-by: Nick Hammond <n.hammond@waracle.com>
Looks good for now, will approve after v6.1 released
This feels more like a plugin than a method of the main library. @Shinigami92 @ST-DDT have you seen a way to add custom user-defined methods to the Faker API? |
This is possible, but it requires casting or subclassing the faker instance. While I agree this kind of custom/specific, moving this to a plugin seems overengeneered to me. We can consider this again, when we have more of these. |
I'm with @ST-DDT, plugins would be over engineered. |
1dff5dc
Adds a function to generate MongoDB ObjectIds
The function aims to be deliberately simple so any combination of
a-z
and0-9
is generated as a valid ObjectId, instead of implementing ObjectIds according to the official specFuthermore, I was unsure where to add the function given it's a datatype for a database, so happy to refactor/move if required.