Having trouble using bytea field in postres when using gorm

Viewed 87

Anyone using bytea field type in postgres and gorm? I'm having trouble if anyone could help me or give me a clue I'm storing bytes of slice of string and when fetching the records, all fields are fetched except the bytea field. It just show empty Struct

type Service struct {
    Name          string           `gorm:"name" json:"name" form:"name" query:"name"`
    Slug          string           `gorm:"slug" json:"slug" form:"slug" query:"slug"`
    ProtocolsByte []byte           `gorm:"protocols" json:"-"`
    Protocols     []string         `json:"protocols" gorm:"-"`
    Features      []ServiceFeature `json:"features"`
    db.BaseModel
}

func (p *Service) AfterFind(tx *gorm.DB) (err error) {
    fmt.Println(p.ProtocolsByte) // Empty
    return
}

And DB has data like https://i.imgur.com/VtctY9C.png Any help is appreciated

0 Answers
Related