用GORM中的关联创建记录?

I am working on a project and relatively new to Golang. I am using GORM for my Database ORM. I don't know what I am doing wrong but I can't get to create records with associations.

type (
    Task struct {
        gorm.Model
        Title       string    `json:"title"`
        Description string    `json:"description"`
        Priority    Priority  `json:"priority_id" validate:"required" gorm:"foreignkey:PriorityID"`
        PriorityID  uint
    }

    Priority struct {
        gorm.Model
        Name      string     `json:"name"`
    }
)

And when I do

task := Task{
    Title:       "Test Task!",
    Description: "Test Task Description",
    Priority:    Priority{ID: 1},
}
db.Create(&task)

It throws me this error:

[2019-07-27 18:34:35] sql: converting argument $7 type: unsupported type models.Priority, a struct

I had a look at GORM Associations but couldn't really find any solution which could make it work.

Gorm is and object-relational mapping (ORM) framework for Go. To create a record with association use something like this:

type (
    Task struct {
        Title       string    `gorm:"column:title"`
        Description string    `gorm:"column:description"`
        PriorityID  int64     `gorm:"column:priority_id"`
        Priority    Priority  `gorm:"foreignkey:PriorityID"`
    }

    Priority struct {
        ID        int64      `gorm:"primary_key"`
        Name      string     `gorm:"column:name"`
    }
)

Then try to add


task := Task{
    Title:       "Test Task!",
    Description: "Test Task Description",
    Priority:    Priority{ID: 1},
}
db.Create(&task)

Please use this link for refer : Gorm Documentation