Hello Everyone.

I am facing an issue when I am trying to insert an array into a column. The 
following is my request

"route": [{"latitude":10.32, "longitude":11.23432}, {"latitude":20.234324, 
"longitude":30.34543}]

I want to store this in 1 column called as Route. This is how my struct 
looks like, 

type Tracker struct {
    gorm.Model
    StartLocation string  `json:"start_location"`
    Route         []Route `json:"route" sql:"type:jsonb"`
    EndLocation   string  `json:"end_location"`
    User          User    `gorm:"ForeignKey:UserID"`
    UserID        int     `json:"user_id"`
}

type Route struct {
    Latitude  float64 `json:"latitude"`
    Longitude float64 `json:"longitude"`
}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to