Random fake data generator written in go
math/rand/v2
Integrationmath/rand/v2
for a more simplistic implementation and two new source types(pcg, chacha8).faker
๐งน: Refined faker
struct for ease of use, mirroring the simplicity improvements of math/rand/v2
.import (
"github.com/brianvoe/gofakeit/v7"
"github.com/brianvoe/gofakeit/v7/source"
"math/rand/v2"
)
// Uses math/rand/v2(PCG Pseudo) with mutex locking
faker := gofakeit.New(0)
// NewFaker takes in a source and whether or not it should be thread safe
faker := gofakeit.NewFaker(source rand.Source, threadSafe bool)
// PCG Pseudo
faker := gofakeit.NewFaker(rand.NewPCG(11, 11), true)
// ChaCha8
faker := gofakeit.NewFaker(rand.NewChaCha8([32]byte{0, 1, 2, 3, 4, 5}), true)
// Additional from Gofakeit sub package source
// JSF(Jenkins Small Fast)
faker := gofakeit.NewFaker(source.NewJSF(11), true)
// SFC(Simple Fast Counter)
faker := gofakeit.NewFaker(source.NewSFC(11), true)
// Crypto - Uses crypto/rand
faker := gofakeit.NewFaker(source.NewCrypto(), true)
// Dumb - simple incrementing number
faker := gofakeit.NewFaker(source.NewDumb(11), true)
A huge shoutout to our contributors and users! Your feedback and support have been invaluable. ๐
Thanks to the contributor @se-omar for all his great work in updating all the descriptions for lookups.
Full Changelog: https://github.com/brianvoe/gofakeit/compare/v6.27.0...v6.28.0
๐ Unleash the Power of Gofakeit 2.0: Elevate Your Data Faking Game! ๐
We're thrilled to introduce the latest and greatest update to Gofakeit, and this time, we've supercharged your data faking experience with a suite of powerful new functions! Say hello to the game-changing Product module, a feature-packed addition that will revolutionize the way you generate fake product information. ๐๏ธโจ
๐ Introducing the Product() Function: Get ready to dive into a world of limitless possibilities with the Product() function! It's your go-to command for creating realistic and captivating fake product data effortlessly. Harness the magic within this function to craft dynamic, authentic product information that will leave your users amazed and engaged.
๐ท๏ธ ProductName() โ Unleash the Creativity: Forge compelling product identities with the ProductName() function. From quirky gadgets to sophisticated fashion pieces, this function lets you generate catchy and unique names that captivate your audience.
๐ ProductDescription() โ Tell a Story: Bring your products to life with the ProductDescription() function! Craft vivid and intriguing descriptions that go beyond the mundane, ensuring your fake data is as immersive as it is imaginative. Spark curiosity and keep your users hooked.
๐ ProductCategory() โ Define the Essence: Organize your products seamlessly with the ProductCategory() function. From electronics to fashion, create a diverse range of categories that add depth and structure to your fake data, making it more realistic and relatable.
๐ ProductFeature() โ Highlight the Best: Elevate your product data with the ProductFeature() function! Showcase unique features that set your fake products apart. Whether it's cutting-edge technology or innovative design, this function lets you highlight the essence of your creations.
๐ ๏ธ ProductMaterial() โ Craft Authenticity: Immerse your users in the tactile world of your fake products with the ProductMaterial() function. Specify materials that resonate with authenticity, allowing your users to envision the quality and feel of the items you've meticulously crafted.
๐ Elevate your data generation game to new heights with Gofakeit 2.0! ๐ Unleash creativity, captivate your audience, and make your fake data more convincing than ever before. The world is your oyster, and with Gofakeit's new Product module, you're the master creator of captivating, realistic product information! ๐๐๐ผ
Upgrade now and experience the thrill of data faking like never before! ๐โจ #Gofakeit
๐ Exciting New Release for Gofakeit v6!
We're thrilled to introduce the latest version of Gofakeit, packed with a powerful addition to enhance your templating experience. Brace yourself for the introduction of custom outputs using Golang's template engine! ๐
SPECIAL THANKS to @Mrpye for his work on this!
๐ญ Template Magic Now, you can unleash your creativity with custom outputs using Golang's template engine. We've integrated all available functions into the template engine, providing you with a versatile toolkit to craft dynamic and personalized content.
๐ Additional Functions But that's not all! We've gone the extra mile and added some game-changing functions to supercharge your template building:
ToUpper & ToLower: Easily manipulate text case for a polished appearance. ToString: Swiftly convert any data type to a string. ToDate: Effortlessly transform strings into time.Time objects. SpliceAny, SpliceString, SpliceUInt, SpliceInt: Build slices dynamically, perfect for weighted scenarios and random selections.
๐ Example Usages To give you a taste of the excitement, here's a snippet showcasing the newfound template capabilities:
// Your template goes here
template := `
Subject: {{RandomString (SliceString "Greetings" "Hello" "Hi")}}
Dear {{LastName}},
{{RandomString (SliceString "Greetings!" "Hello there!" "Hi, how are you?")}}
{{Paragraph 1 5 10 "\n\n"}}
{{RandomString (SliceString "Warm regards" "Best wishes" "Sincerely")}}
{{$person:=Person}}
{{$person.FirstName}} {{$person.LastName}}
{{$person.Email}}
{{$person.Phone}}
`
// Applying the template
value, err := gofakeit.Template(template, nil)
Thanks to the help of @ViridianForge and @dminkovski! We now have Books, Movies, Middle Names, Blurbs and Company Slogans.
See https://github.com/brianvoe/gofakeit#fakeable-types
Full Changelog: https://github.com/brianvoe/gofakeit/compare/v6.20.2...v6.21.0