Posts

Showing posts from August, 2020

Simplest REST API CRUD using mysql in Golang

Image
This is Another interesting article, In this project, we are creating a simple REST API for book and perform simple CRUD operation using MySQL database. we also use gorilla mux router. and tested API on POSTMAN. Testing endpoints using  POSTMAN 1. createBook 2. getBook 3. getBooks 4. updateBook 5. deleteBook Final getBooks source code Thanks for Reading, Keep Learning.

Generating UUID in Golang and Insert Read ID's using BBolt DB.

Image
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 ( Sequent