Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
¿Hay algún problema concurrente con la función de creación de gorm?

Estoy usando gorm con mysql en mi aplicación Go.

Aquí aplico la función gorm create() para insertar mi estructura que contiene una identificación de incremento automático como clave principal.

 type DBModel struct { ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT"` ... }

En realidad, después de crear, se llamaría a una "selección" para completar esta estructura con los últimos datos de inserción de db.

Entonces, ¿qué pasa si varias creaciones suceden juntas? Digamos que creo model_A, model_B ... al mismo tiempo, ¿obtendrían todos los datos correctos?

Como compruebo desde gorm, create() es la combinación de insert y select from last_insert_id . ¿Cómo garantizaría gorm/mysql el last_insert_id correcto después de la inserción?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!