I'm using gorm with mysql in my Go app.
Here I apply gorm create() function to insert my struct which contains auto-increment id as primary key.
type DBModel struct {
ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT"`
...
}
Actually after create, a "select" would be called to fill this struct with last insert data from db.
So what if several create happens together? Say I create model_A, model_B ... at same time, would all of them get correct data?
As I check from gorm, create() is the combination of insert and select from last_insert_id. How would gorm/mysql ensure correct last_insert_id after insert?