[ad_1]
i have the following table created in postgres using the goqu library, there will only be one value in the column at any point and I want to use select for update
to lock the rows before overwriting the value to prevent concurrency.
table:
This is what I tried:
type data struct {
ID int `db:"user_id"`
}
var new_id data
new_id = data{Id: 4321,}
DB.Select(data{}).From(tablename).ForUpdate(exp.SkipLocked).Insert().Rows(new_id).Executor().Exec()
But this command seems to create new rows instead of overwriting the value. Any help is appreciated!
[ad_2]