Generating UUID in Golang and Insert Read ID's using BBolt DB.
UUID is the most commonly used in backend development. for generating unique ids in the system for different components. to uniquely identify each component. read more about UUID
In this article, we will see how to generate a UUID in golang based on user input.
user will provide how many character id want to generate and how many id's want to create.
I create it has a package you can directly use it.
code is self-explained with comments for each function.
this is more practical rather than theory.
The small project contains.
1. Generating UUID based on Base62 algorithm you can use more efficient third party packages for the same some examples. I keep STD package
2. Putting ( inserting generated ids into a bucket ( we are using bbolt database) sequential write.
3. Checking Duplicate ID's While inserting make sure there should not a duplicate id we know it should be unique but for the sanity check also good to test (but time-consuming)
4. Reading IDs from Bucket ( Sequential Read its super-fast as compare to other databases)
BBolt is Key-Value database can read more BBolt DB
5.Unit Test and Benchmark Test
2. Putting ( inserting generated ids into a bucket ( we are using bbolt database) sequential write.
3. Checking Duplicate ID's While inserting make sure there should not a duplicate id we know it should be unique but for the sanity check also good to test (but time-consuming)
4. Reading IDs from Bucket ( Sequential Read its super-fast as compare to other databases)
BBolt is Key-Value database can read more BBolt DB
5.Unit Test and Benchmark Test
Contributor @Ashish_Nikalje
https://www.linkedin.com/in/ashish-nikalje-815858122/
Comments
Post a Comment