Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

248
Vistas
Is there any concurrent issue with gorm create function?

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?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda