how to define list of string on gorm model?


this is my model

type Ticket struct {

    PassengerName string         `json:"passenger_name"`
    Price         uint64         `json:"price"`
    Seat          pq.StringArray `gorm:"type:string[]" json:"seat"`
} ERROR: type "string[]" does not exist (SQLSTATE 42704)


There’s no string data type in postgre. Change string[] to text[]

Answered By – Rahmat Fathoni

Answer Checked By – Pedro (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.