How to insert more than one gorm at a time

this dish uses gorm to insert data into the database, but it is found that it is not good to insert more than one item at a time. It seems that gorm does not support multiple inserts. Ask God to recommend a good orm,. Thank you, 2333333

.
Mar.11,2021

gorm does not insert in bulk, but you can do this

INSERT INTO `users` VALUES (?,?,?),(?,?,?)

A little clumsy


@ mataye currently gorm does not support bulk insertion, but it has been included in v2.0

. For a detailed discussion of

you can see issues-255 , where the discussion contains a lot of information and is reasonable and positive.

in addition, at present, in the case of v1.x, if you want to use gorm for bulk insertion, please see the following way:

https://stackoverflow.com/que.
https://stackoverflow.com/que.

in addition, xorm supports batch insertion, but each has its own advantages.

is also discussed in issues.

look at it carefully, can you solve your doubts very well?


batch insert self-assembled statements is fine, why rely too much on encapsulation function libraries

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eab33f-47e10.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eab33f-47e10.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?