Set multiple fields as primary key creates composite primary key, for example:

    1. type Product struct {
    2. ID string `gorm:"primaryKey"`
    3. LanguageCode string `gorm:"primaryKey"`
    4. Code string
    5. Name string
    6. }

    Note integer PrioritizedPrimaryField enables AutoIncrement by default, to disable it, you need to turn off autoIncrement for the int fields:

    1. type Product struct {
    2. CategoryID uint64 `gorm:"primaryKey;autoIncrement:false"`
    3. TypeID uint64 `gorm:"primaryKey;autoIncrement:false"`
    4. }