I am a software developer at heart who likes to travel and has a profound interest in design, art, and literature.
Night view of golden temple
Night view of Golden Temple

Re-living Amritsar, 4th Jan 2020

I and my friend decided to visit the holy land of Sikhs on the first weekend of 2020 and what a blissful weekend it turned out to be. Have you ever had vegetarian food that makes you feel high? Have you had a chance to…

Image Source: Google

GORM is the ORM library for Golang, built and maintained by Jinzhu. Since you have stumbled upon this article I would safely assume that you have been coding using GoLang for a while now and are a GORM user already.

I have been working with gorm for a while now and recently had a use case where I wanted to perform bulk writes to MySQL database. Upon exploring the documentation, I found that gorm doesn’t support bulk writes/updates (in V1). I went through the open items on their GitHub repo and found some helpful comments which led me to write this small function, which supports batch upserts for GORM.

Update: GORM V2 provides bulk operations out of the box.

Please find all of my gorm-plugin listed here.

Sumit Agarwal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store