Your Question
I know it's probably already been answered, but after intensive googling I could only find the github pull request adding the auto increment feature, and no information about the problem I'm currently facing.
I need to define a table, with an integer ID primary key, without auto incrementing.
type Model struct {
ID uint `gorm:"primaryKey"`
}
The ID can't be auto incrementing but explicitly set, because it comes from a different data source.
I tried adding the tag default:0 but it raise the following error:
ERROR: multiple default values specified for column "id" of table "players"
I'm using Postegres as DB
The document you expected this should be explained
It should probably be added a small explanation here: https://gorm.io/docs/models.html#gorm-Model
Expected answer
A solution for creating a table with an integer primary key and no auto increment
Comment From: gbalduzzi
I didn't expect the autoIncrement tag to have a parameter, I solved adding the following tag:
autoIncrement:false