You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a generic function to bulk upsert objects in MSSQL and I wanted to check if this looks correct? I've used some code from this stackoverflow question, but the docs are a little sparse regarding the clause.OnConflict for my current knowledge.
Am I right in assuming that in clause.OnConflict the Columns field is to specify the primary key since this is what the conflict would be caused by? And that DoUpdates specifies which fields should still be updated?
So, in my case here I'm saying conflict on all primary keys and update all columns on conflict?
The document you expected this should be explained
Your Question
I'm trying to write a generic function to bulk upsert objects in MSSQL and I wanted to check if this looks correct? I've used some code from this stackoverflow question, but the docs are a little sparse regarding the clause.OnConflict for my current knowledge.
Am I right in assuming that in
clause.OnConflict
theColumns
field is to specify the primary key since this is what the conflict would be caused by? And thatDoUpdates
specifies which fields should still be updated?So, in my case here I'm saying conflict on all primary keys and update all columns on conflict?
The document you expected this should be explained
https://gorm.io/docs/create.html#Batch-Insert
Expected answer
I'd like for this to be correct and possibly pointing to some documentation I've missed, or for the documentation to be updated slightly?
Many thanks.
The text was updated successfully, but these errors were encountered: