I created data with golang gorm, I need to form a relationship in another table based on the generated data id, but I don't know how to check the generated data, how can I check the generated data?
func DefaultMapCreate(userId uint) *model.Map {
var temp model.Map
db.Raw("INSERT INTO maps(title, location, created_at, updated_at) VALUES (?, ?, ?, ?)", "default", "test", time.Now(), time.Now()).Scan(&temp)
return &temp
}
I want to put the data generated in the code above into &temp and generate other data in the same function based on it.
But I can't create relational data because I don't know how to get the generated data back. Please help!, I need id value for generated data, id value is auto increment type